2752406: [LSC] Replace base::string16 with std::u16string in //ui

https://chromium-review.googlesource.com/c/chromium/src/+/2752406
This commit is contained in:
John Kleinschmidt 2021-03-15 21:21:27 -04:00
Родитель d4bec23bde
Коммит 9e336f5d0c
8 изменённых файлов: 15 добавлений и 15 удалений

Просмотреть файл

@ -78,7 +78,7 @@ void MenuBar::SetAcceleratorVisibility(bool visible) {
static_cast<SubmenuButton*>(child)->SetAcceleratorVisibility(visible);
}
MenuBar::View* MenuBar::FindAccelChild(base::char16 key) {
MenuBar::View* MenuBar::FindAccelChild(char16_t key) {
for (auto* child : GetChildrenInZOrder()) {
if (static_cast<SubmenuButton*>(child)->accelerator() == key)
return child;
@ -86,11 +86,11 @@ MenuBar::View* MenuBar::FindAccelChild(base::char16 key) {
return nullptr;
}
bool MenuBar::HasAccelerator(base::char16 key) {
bool MenuBar::HasAccelerator(char16_t key) {
return FindAccelChild(key) != nullptr;
}
void MenuBar::ActivateAccelerator(base::char16 key) {
void MenuBar::ActivateAccelerator(char16_t key) {
auto* child = FindAccelChild(key);
if (child)
static_cast<SubmenuButton*>(child)->Activate(nullptr);

Просмотреть файл

@ -51,10 +51,10 @@ class MenuBar : public views::AccessiblePaneView,
void SetAcceleratorVisibility(bool visible);
// Returns true if the submenu has accelerator |key|
bool HasAccelerator(base::char16 key);
bool HasAccelerator(char16_t key);
// Shows the submenu whose accelerator is |key|.
void ActivateAccelerator(base::char16 key);
void ActivateAccelerator(char16_t key);
// Returns there are how many items in the root menu.
int GetItemCount() const;
@ -95,7 +95,7 @@ class MenuBar : public views::AccessiblePaneView,
RootView* window_ = nullptr;
ElectronMenuModel* menu_model_ = nullptr;
View* FindAccelChild(base::char16 key);
View* FindAccelChild(char16_t key);
bool has_focus_ = true;

Просмотреть файл

@ -90,7 +90,7 @@ void SubmenuButton::PaintButtonContents(gfx::Canvas* canvas) {
}
bool SubmenuButton::GetUnderlinePosition(const base::string16& text,
base::char16* accelerator,
char16_t* accelerator,
int* start,
int* end) const {
int pos, span;

Просмотреть файл

@ -24,7 +24,7 @@ class SubmenuButton : public views::MenuButton {
void SetAcceleratorVisibility(bool visible);
void SetUnderlineColor(SkColor color);
base::char16 accelerator() const { return accelerator_; }
char16_t accelerator() const { return accelerator_; }
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
@ -37,14 +37,14 @@ class SubmenuButton : public views::MenuButton {
private:
bool GetUnderlinePosition(const base::string16& text,
base::char16* accelerator,
char16_t* accelerator,
int* start,
int* end) const;
void GetCharacterPosition(const base::string16& text,
int index,
int* pos) const;
base::char16 accelerator_ = 0;
char16_t accelerator_ = 0;
bool show_underline_ = false;

Просмотреть файл

@ -44,10 +44,10 @@ int VectorToBitArray(const std::vector<T>& vec) {
namespace gin {
template <>
struct Converter<base::char16> {
struct Converter<char16_t> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
base::char16* out) {
char16_t* out) {
base::string16 code = base::UTF8ToUTF16(gin::V8ToString(isolate, val));
if (code.length() != 1)
return false;

Просмотреть файл

@ -138,7 +138,7 @@ ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& s,
} // namespace
ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted) {
ui::KeyboardCode KeyboardCodeFromCharCode(char16_t c, bool* shifted) {
c = base::ToLowerASCII(c);
*shifted = false;
switch (c) {

Просмотреть файл

@ -14,7 +14,7 @@ namespace electron {
// Return key code of the char, and also determine whether the SHIFT key is
// pressed.
ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted);
ui::KeyboardCode KeyboardCodeFromCharCode(char16_t c, bool* shifted);
// Return key code of the |str|, and also determine whether the SHIFT key is
// pressed.

Просмотреть файл

@ -29,7 +29,7 @@ namespace api {
namespace {
bool HasWordCharacters(const base::string16& text, int index) {
const base::char16* data = text.data();
const char16_t* data = text.data();
int length = text.length();
while (index < length) {
uint32_t code = 0;