-
Notifications
You must be signed in to change notification settings - Fork 879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add strings for NavigationBar on relevant WebUI data sources directly #2384
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) 2019 The Brave Authors | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// you can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#include "brave/browser/ui/webui/navigation_bar_data_provider.h" | ||
|
||
#include "chrome/grit/generated_resources.h" | ||
#include "components/strings/grit/components_strings.h" | ||
#include "content/public/browser/web_ui_data_source.h" | ||
|
||
// static | ||
void NavigationBarDataProvider::Initialize(content::WebUIDataSource* source) { | ||
source->AddLocalizedString( | ||
"brToolbarSettingsTitle", IDS_SETTINGS_SETTINGS); | ||
source->AddLocalizedString( | ||
"brToolbarBookmarksTitle", IDS_BOOKMARK_MANAGER_TITLE); | ||
source->AddLocalizedString( | ||
"brToolbarDownloadsTitle", IDS_DOWNLOAD_TITLE); | ||
source->AddLocalizedString( | ||
"brToolbarHistoryTitle", IDS_HISTORY_TITLE); | ||
} | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) 2019 The Brave Authors | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// you can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#ifndef BRAVE_BROWSER_UI_WEBUI_NAVIGATION_BAR_DATA_PROVIDER_H | ||
#define BRAVE_BROWSER_UI_WEBUI_NAVIGATION_BAR_DATA_PROVIDER_H | ||
|
||
namespace content { | ||
class WebUIDataSource; | ||
} | ||
|
||
class NavigationBarDataProvider { | ||
public: | ||
// Sets load-time constants on |source|. This handles a flicker-free initial | ||
// page load (i.e. loadTimeData.getString('brToolbarSettingsTitle')). | ||
static void Initialize(content::WebUIDataSource* source); | ||
}; | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2019 The Brave Authors | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// you can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#include "brave/browser/ui/webui/navigation_bar_data_provider.h" | ||
|
||
namespace { | ||
|
||
void BraveCustomizeBookmarksDataSource(content::WebUIDataSource* source) { | ||
NavigationBarDataProvider::Initialize(source); | ||
} | ||
|
||
} // namespace | ||
|
||
#include "../../../../../../chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lint |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2019 The Brave Authors | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// you can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#include "brave/browser/ui/webui/navigation_bar_data_provider.h" | ||
|
||
namespace { | ||
|
||
void BraveCustomizeDownloadsDataSource(content::WebUIDataSource* source) { | ||
NavigationBarDataProvider::Initialize(source); | ||
} | ||
|
||
} // namespace | ||
|
||
#include "../../../../../../chrome/browser/ui/webui/downloads/downloads_ui.cc" // NOLINT | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lint fail by no last empty line? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2019 The Brave Authors | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// you can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#include "brave/browser/ui/webui/navigation_bar_data_provider.h" | ||
|
||
namespace { | ||
|
||
void BraveCustomizeHistoryDataSource(content::WebUIDataSource* source) { | ||
NavigationBarDataProvider::Initialize(source); | ||
} | ||
|
||
} // namespace | ||
|
||
#include "../../../../../chrome/browser/ui/webui/history_ui.cc" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lint? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,48 +3,14 @@ | |
#include "brave/ui/webui/resources/grit/brave_webui_resources.h" | ||
#include "ui/resources/grit/webui_resources.h" | ||
|
||
#define SetLoadTimeDataDefaults SetLoadTimeDataDefaults_ChromiumImpl | ||
// Replace text_defaults.css with brave's text_defaults.css | ||
// which is defined in brave_webui_resources.grd. | ||
#define IDR_WEBUI_CSS_TEXT_DEFAULTS_MD_PREVIOUS IDR_WEBUI_CSS_TEXT_DEFAULTS_MD | ||
#undef IDR_WEBUI_CSS_TEXT_DEFAULTS_MD | ||
#define IDR_WEBUI_CSS_TEXT_DEFAULTS_MD IDR_BRAVE_WEBUI_CSS_TEXT_DEFAULTS | ||
#include "../../../../../ui/base/webui/web_ui_util.cc" | ||
#undef SetLoadTimeDataDefaults | ||
#undef IDR_WEBUI_CSS_TEXT_DEFAULTS_MD | ||
#define IDR_WEBUI_CSS_TEXT_DEFAULTS_MD IDR_WEBUI_CSS_TEXT_DEFAULTS_MD_PREVIOUS | ||
|
||
#include "chrome/grit/generated_resources.h" | ||
#include "components/strings/grit/components_strings.h" | ||
#include "ui/base/l10n/l10n_util.h" | ||
|
||
namespace webui { | ||
|
||
void SetLoadTimeDataDefaults(const std::string& app_locale, | ||
base::DictionaryValue* localized_strings) { | ||
|
||
SetLoadTimeDataDefaults_ChromiumImpl(app_locale, localized_strings); | ||
#if !defined(OS_ANDROID) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This define pair can be removed |
||
localized_strings->SetString( | ||
"brToolbarSettingsTitle", | ||
l10n_util::GetStringUTF16(IDS_SETTINGS_SETTINGS) | ||
); | ||
#endif | ||
localized_strings->SetString( | ||
"brToolbarBookmarksTitle", | ||
l10n_util::GetStringUTF16(IDS_BOOKMARK_MANAGER_TITLE) | ||
); | ||
localized_strings->SetString( | ||
"brToolbarDownloadsTitle", | ||
l10n_util::GetStringUTF16(IDS_DOWNLOAD_TITLE) | ||
); | ||
localized_strings->SetString( | ||
"brToolbarHistoryTitle", | ||
l10n_util::GetStringUTF16(IDS_HISTORY_TITLE) | ||
); | ||
} | ||
|
||
void SetLoadTimeDataDefaults(const std::string& app_locale, | ||
ui::TemplateReplacements* replacements) { | ||
SetLoadTimeDataDefaults_ChromiumImpl(app_locale, replacements); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc b/chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc | ||
index 0542e022aeaedc240cf0bc79b9acebfe121fcc4d..ac9fe90cb2d96fa9850c066ae33630a60bf4ba22 100644 | ||
--- a/chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc | ||
+++ b/chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc | ||
@@ -45,6 +45,7 @@ content::WebUIDataSource* CreateBookmarksUIHTMLSource(Profile* profile) { | ||
content::WebUIDataSource* source = | ||
content::WebUIDataSource::Create(chrome::kChromeUIBookmarksHost); | ||
|
||
+ BraveCustomizeBookmarksDataSource(source); | ||
// Build an Accelerator to describe undo shortcut | ||
// NOTE: the undo shortcut is also defined in bookmarks/command_manager.js | ||
// TODO(b/893033): de-duplicate shortcut by moving all shortcut definitions |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/chrome/browser/ui/webui/downloads/downloads_ui.cc b/chrome/browser/ui/webui/downloads/downloads_ui.cc | ||
index 9f595a7bbb7adc1e42fd7eac31d0b8819deda532..41bfbeddcc010e8c76cf198c64d428d274b44137 100644 | ||
--- a/chrome/browser/ui/webui/downloads/downloads_ui.cc | ||
+++ b/chrome/browser/ui/webui/downloads/downloads_ui.cc | ||
@@ -47,6 +47,7 @@ content::WebUIDataSource* CreateDownloadsUIHTMLSource(Profile* profile) { | ||
content::WebUIDataSource* source = | ||
content::WebUIDataSource::Create(chrome::kChromeUIDownloadsHost); | ||
|
||
+ BraveCustomizeDownloadsDataSource(source); | ||
source->AddLocalizedString("title", IDS_DOWNLOAD_TITLE); | ||
source->AddLocalizedString("searchResultsPlural", IDS_SEARCH_RESULTS_PLURAL); | ||
source->AddLocalizedString("searchResultsSingular", |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc | ||
index b6b6f4f7aa79a1c3a44a187c1f618e10194442bd..09a0d991a87ff90c84678ac0f6325a8e5076560a 100644 | ||
--- a/chrome/browser/ui/webui/history_ui.cc | ||
+++ b/chrome/browser/ui/webui/history_ui.cc | ||
@@ -56,6 +56,7 @@ content::WebUIDataSource* CreateHistoryUIHTMLSource(Profile* profile) { | ||
content::WebUIDataSource* source = | ||
content::WebUIDataSource::Create(chrome::kChromeUIHistoryHost); | ||
|
||
+ BraveCustomizeHistoryDataSource(source); | ||
// Localized strings (alphabetical order). | ||
source->AddLocalizedString("actionMenuDescription", | ||
IDS_HISTORY_ACTION_MENU_DESCRIPTION); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
group("chromium_deps") { | ||
deps = [ | ||
"//brave/ui/webui/resources", | ||
"//brave/app:brave_generated_resources_grit", | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint?