Commit 9fd40ee5 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Replace kFileButtonChoose[FileLabel|MultipleFilesLabel] with IDS_FOO

As a step to remove all uses of WebLocalizedString::kFooBar,
this CL replaces below ones with matched IDS_FOO.

  - WebLocalizedString::kFileButtonChooseFileLabel
  - WebLocalizedString::kFileButtonChooseMultipleFilesLabel

This CL keeps ToMessageID() and makes ToMessageID() returns
|resource_id| as is if it doesn't match to any of
WebLocalizedString::kFoo to replace WebLocalizedString::kFoo
gradually.

Bug: 995644
Change-Id: Ia56045df0b854f2da4cdfef167644ced277d8ec3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1768500Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#698831}
parent 08af3458
...@@ -188,10 +188,6 @@ int ToMessageID(int resource_id) { ...@@ -188,10 +188,6 @@ int ToMessageID(int resource_id) {
return IDS_FORM_CALENDAR_TODAY; return IDS_FORM_CALENDAR_TODAY;
case WebLocalizedString::kDetailsLabel: case WebLocalizedString::kDetailsLabel:
return IDS_DETAILS_WITHOUT_SUMMARY_LABEL; return IDS_DETAILS_WITHOUT_SUMMARY_LABEL;
case WebLocalizedString::kFileButtonChooseFileLabel:
return IDS_FORM_FILE_BUTTON_LABEL;
case WebLocalizedString::kFileButtonChooseMultipleFilesLabel:
return IDS_FORM_MULTIPLE_FILES_BUTTON_LABEL;
case WebLocalizedString::kFileButtonNoFileSelectedLabel: case WebLocalizedString::kFileButtonNoFileSelectedLabel:
return IDS_FORM_FILE_NO_FILE_LABEL; return IDS_FORM_FILE_NO_FILE_LABEL;
case WebLocalizedString::kInputElementAltText: case WebLocalizedString::kInputElementAltText:
...@@ -342,14 +338,17 @@ int ToMessageID(int resource_id) { ...@@ -342,14 +338,17 @@ int ToMessageID(int resource_id) {
return IDS_UNITS_TEBIBYTES; return IDS_UNITS_TEBIBYTES;
case WebLocalizedString::kUnitsPebibytes: case WebLocalizedString::kUnitsPebibytes:
return IDS_UNITS_PEBIBYTES; return IDS_UNITS_PEBIBYTES;
// There is no matched IDS_FOO for kBlockedPluginText. Return -1.
case WebLocalizedString::kBlockedPluginText:
return -1;
// This "default:" line exists to avoid compile warnings about enum // This "default:" line exists to avoid compile warnings about enum
// coverage when we add a new symbol to WebLocalizedString.h in WebKit. // coverage when we add a new symbol to WebLocalizedString.h in blink.
// After a planned WebKit patch is landed, we need to add a case statement // After a planned blink patch is landed, we need to add a case statement
// for the added symbol here. // for the added symbol here.
default: default:
break; break;
} }
return -1; return resource_id;
} }
// This must match third_party/WebKit/public/blink_resources.grd. // This must match third_party/WebKit/public/blink_resources.grd.
......
...@@ -86,8 +86,6 @@ struct WebLocalizedString { ...@@ -86,8 +86,6 @@ struct WebLocalizedString {
kCalendarClear, kCalendarClear,
kCalendarToday, kCalendarToday,
kDetailsLabel, kDetailsLabel,
kFileButtonChooseFileLabel,
kFileButtonChooseMultipleFilesLabel,
kFileButtonNoFileSelectedLabel, kFileButtonNoFileSelectedLabel,
kInputElementAltText, kInputElementAltText,
kMediaRemotingCastText, kMediaRemotingCastText,
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "third_party/blink/renderer/core/html/forms/file_input_type.h" #include "third_party/blink/renderer/core/html/forms/file_input_type.h"
#include "third_party/blink/public/platform/file_path_conversion.h" #include "third_party/blink/public/platform/file_path_conversion.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/blink/renderer/core/css/style_change_reason.h" #include "third_party/blink/renderer/core/css/style_change_reason.h"
#include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h" #include "third_party/blink/renderer/core/dom/shadow_root.h"
...@@ -315,9 +316,8 @@ void FileInputType::CreateShadowSubtree() { ...@@ -315,9 +316,8 @@ void FileInputType::CreateShadowSubtree() {
button->setAttribute( button->setAttribute(
kValueAttr, kValueAttr,
AtomicString(GetLocale().QueryString( AtomicString(GetLocale().QueryString(
GetElement().Multiple() GetElement().Multiple() ? IDS_FORM_MULTIPLE_FILES_BUTTON_LABEL
? WebLocalizedString::kFileButtonChooseMultipleFilesLabel : IDS_FORM_FILE_BUTTON_LABEL)));
: WebLocalizedString::kFileButtonChooseFileLabel)));
button->SetShadowPseudoId(AtomicString("-webkit-file-upload-button")); button->SetShadowPseudoId(AtomicString("-webkit-file-upload-button"));
GetElement().UserAgentShadowRoot()->AppendChild(button); GetElement().UserAgentShadowRoot()->AppendChild(button);
} }
...@@ -337,13 +337,13 @@ void FileInputType::MultipleAttributeChanged() { ...@@ -337,13 +337,13 @@ void FileInputType::MultipleAttributeChanged() {
CHECK(!GetElement().UserAgentShadowRoot()->firstChild() || CHECK(!GetElement().UserAgentShadowRoot()->firstChild() ||
IsA<Element>(GetElement().UserAgentShadowRoot()->firstChild())); IsA<Element>(GetElement().UserAgentShadowRoot()->firstChild()));
if (Element* button = if (Element* button =
To<Element>(GetElement().UserAgentShadowRoot()->firstChild())) To<Element>(GetElement().UserAgentShadowRoot()->firstChild())) {
button->setAttribute( button->setAttribute(
kValueAttr, kValueAttr,
AtomicString(GetLocale().QueryString( AtomicString(GetLocale().QueryString(
GetElement().Multiple() GetElement().Multiple() ? IDS_FORM_MULTIPLE_FILES_BUTTON_LABEL
? WebLocalizedString::kFileButtonChooseMultipleFilesLabel : IDS_FORM_FILE_BUTTON_LABEL)));
: WebLocalizedString::kFileButtonChooseFileLabel))); }
} }
bool FileInputType::SetFiles(FileList* files) { bool FileInputType::SetFiles(FileList* files) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment