OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/md_history_ui.h" | 5 #include "chrome/browser/ui/webui/md_history_ui.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_factory.h" |
11 #include "chrome/browser/ui/webui/browsing_history_handler.h" | 11 #include "chrome/browser/ui/webui/browsing_history_handler.h" |
12 #include "chrome/browser/ui/webui/foreign_session_handler.h" | 12 #include "chrome/browser/ui/webui/foreign_session_handler.h" |
13 #include "chrome/browser/ui/webui/history_login_handler.h" | 13 #include "chrome/browser/ui/webui/history_login_handler.h" |
14 #include "chrome/browser/ui/webui/history_ui.h" | 14 #include "chrome/browser/ui/webui/history_ui.h" |
15 #include "chrome/browser/ui/webui/metrics_handler.h" | 15 #include "chrome/browser/ui/webui/metrics_handler.h" |
16 #include "chrome/browser/ui/webui/settings/people_handler.h" | 16 #include "chrome/browser/ui/webui/settings/people_handler.h" |
17 #include "chrome/common/chrome_features.h" | 17 #include "chrome/common/chrome_features.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 21 #include "chrome/grit/locale_settings.h" |
21 #include "components/prefs/pref_service.h" | 22 #include "components/prefs/pref_service.h" |
22 #include "components/search/search.h" | 23 #include "components/search/search.h" |
23 #include "components/signin/core/browser/signin_manager.h" | 24 #include "components/signin/core/browser/signin_manager.h" |
24 #include "content/public/browser/web_ui.h" | 25 #include "content/public/browser/web_ui.h" |
25 #include "content/public/browser/web_ui_data_source.h" | 26 #include "content/public/browser/web_ui_data_source.h" |
26 #include "grit/browser_resources.h" | 27 #include "grit/browser_resources.h" |
27 #include "grit/components_scaled_resources.h" | 28 #include "grit/components_scaled_resources.h" |
28 #include "grit/components_strings.h" | 29 #include "grit/components_strings.h" |
29 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
30 #include "grit/theme_resources.h" | 31 #include "grit/theme_resources.h" |
| 32 #include "ui/base/l10n/l10n_util.h" |
31 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
32 | 34 |
33 namespace { | 35 namespace { |
34 | 36 |
35 content::WebUIDataSource* CreateMdHistoryUIHTMLSource(Profile* profile) { | 37 content::WebUIDataSource* CreateMdHistoryUIHTMLSource(Profile* profile) { |
36 PrefService* prefs = profile->GetPrefs(); | 38 PrefService* prefs = profile->GetPrefs(); |
37 | 39 |
38 content::WebUIDataSource* source = | 40 content::WebUIDataSource* source = |
39 content::WebUIDataSource::Create(chrome::kChromeUIHistoryHost); | 41 content::WebUIDataSource::Create(chrome::kChromeUIHistoryHost); |
40 | 42 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 source->AddLocalizedString("searchResult", IDS_HISTORY_SEARCH_RESULT); | 79 source->AddLocalizedString("searchResult", IDS_HISTORY_SEARCH_RESULT); |
78 source->AddLocalizedString("searchResults", IDS_HISTORY_SEARCH_RESULTS); | 80 source->AddLocalizedString("searchResults", IDS_HISTORY_SEARCH_RESULTS); |
79 source->AddLocalizedString("signInButton", IDS_MD_HISTORY_SIGN_IN_BUTTON); | 81 source->AddLocalizedString("signInButton", IDS_MD_HISTORY_SIGN_IN_BUTTON); |
80 source->AddLocalizedString("signInPromo", IDS_MD_HISTORY_SIGN_IN_PROMO); | 82 source->AddLocalizedString("signInPromo", IDS_MD_HISTORY_SIGN_IN_PROMO); |
81 source->AddLocalizedString("signInPromoDesc", | 83 source->AddLocalizedString("signInPromoDesc", |
82 IDS_MD_HISTORY_SIGN_IN_PROMO_DESC); | 84 IDS_MD_HISTORY_SIGN_IN_PROMO_DESC); |
83 source->AddLocalizedString("title", IDS_HISTORY_TITLE); | 85 source->AddLocalizedString("title", IDS_HISTORY_TITLE); |
84 | 86 |
85 source->AddString("deleteWarning", | 87 source->AddString("deleteWarning", |
86 HistoryUI::GetDeleteWarningString(profile)); | 88 HistoryUI::GetDeleteWarningString(profile)); |
| 89 source->AddString( |
| 90 "sidebarFooter", |
| 91 l10n_util::GetStringFUTF16( |
| 92 IDS_HISTORY_OTHER_FORMS_OF_HISTORY, |
| 93 l10n_util::GetStringUTF16( |
| 94 IDS_SETTINGS_CLEAR_DATA_WEB_HISTORY_URL_IN_HISTORY))); |
87 | 95 |
88 bool allow_deleting_history = | 96 bool allow_deleting_history = |
89 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); | 97 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); |
90 source->AddBoolean("allowDeletingHistory", allow_deleting_history); | 98 source->AddBoolean("allowDeletingHistory", allow_deleting_history); |
91 | 99 |
92 bool group_by_domain = base::CommandLine::ForCurrentProcess()->HasSwitch( | 100 bool group_by_domain = base::CommandLine::ForCurrentProcess()->HasSwitch( |
93 switches::kHistoryEnableGroupByDomain) || profile->IsSupervised(); | 101 switches::kHistoryEnableGroupByDomain) || profile->IsSupervised(); |
94 source->AddBoolean("groupByDomain", group_by_domain); | 102 source->AddBoolean("groupByDomain", group_by_domain); |
95 | 103 |
96 SigninManagerBase* signin_manager = | 104 SigninManagerBase* signin_manager = |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 base::FeatureList::ClearInstanceForTesting(); | 197 base::FeatureList::ClearInstanceForTesting(); |
190 base::FeatureList::SetInstance(std::move(feature_list)); | 198 base::FeatureList::SetInstance(std::move(feature_list)); |
191 } | 199 } |
192 | 200 |
193 // static | 201 // static |
194 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( | 202 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( |
195 ui::ScaleFactor scale_factor) { | 203 ui::ScaleFactor scale_factor) { |
196 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 204 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
197 IDR_HISTORY_FAVICON, scale_factor); | 205 IDR_HISTORY_FAVICON, scale_factor); |
198 } | 206 } |
OLD | NEW |