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/metrics_handler.h" | 14 #include "chrome/browser/ui/webui/metrics_handler.h" |
15 #include "chrome/browser/ui/webui/settings/people_handler.h" | 15 #include "chrome/browser/ui/webui/settings/people_handler.h" |
16 #include "chrome/common/chrome_features.h" | 16 #include "chrome/common/chrome_features.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 20 #include "chrome/grit/locale_settings.h" |
20 #include "components/prefs/pref_service.h" | 21 #include "components/prefs/pref_service.h" |
21 #include "components/search/search.h" | 22 #include "components/search/search.h" |
22 #include "components/signin/core/browser/signin_manager.h" | 23 #include "components/signin/core/browser/signin_manager.h" |
23 #include "content/public/browser/web_ui.h" | 24 #include "content/public/browser/web_ui.h" |
24 #include "content/public/browser/web_ui_data_source.h" | 25 #include "content/public/browser/web_ui_data_source.h" |
25 #include "grit/browser_resources.h" | 26 #include "grit/browser_resources.h" |
26 #include "grit/components_scaled_resources.h" | 27 #include "grit/components_scaled_resources.h" |
27 #include "grit/components_strings.h" | 28 #include "grit/components_strings.h" |
28 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
29 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
| 31 #include "ui/base/l10n/l10n_util.h" |
30 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
31 | 33 |
32 namespace { | 34 namespace { |
33 | 35 |
34 content::WebUIDataSource* CreateMdHistoryUIHTMLSource(Profile* profile) { | 36 content::WebUIDataSource* CreateMdHistoryUIHTMLSource(Profile* profile) { |
35 PrefService* prefs = profile->GetPrefs(); | 37 PrefService* prefs = profile->GetPrefs(); |
36 | 38 |
37 content::WebUIDataSource* source = | 39 content::WebUIDataSource* source = |
38 content::WebUIDataSource::Create(chrome::kChromeUIHistoryHost); | 40 content::WebUIDataSource::Create(chrome::kChromeUIHistoryHost); |
39 | 41 |
(...skipping 30 matching lines...) Expand all Loading... |
70 source->AddLocalizedString("removeFromHistory", IDS_HISTORY_REMOVE_PAGE); | 72 source->AddLocalizedString("removeFromHistory", IDS_HISTORY_REMOVE_PAGE); |
71 source->AddLocalizedString("searchPrompt", IDS_MD_HISTORY_SEARCH_PROMPT); | 73 source->AddLocalizedString("searchPrompt", IDS_MD_HISTORY_SEARCH_PROMPT); |
72 source->AddLocalizedString("searchResult", IDS_HISTORY_SEARCH_RESULT); | 74 source->AddLocalizedString("searchResult", IDS_HISTORY_SEARCH_RESULT); |
73 source->AddLocalizedString("searchResults", IDS_HISTORY_SEARCH_RESULTS); | 75 source->AddLocalizedString("searchResults", IDS_HISTORY_SEARCH_RESULTS); |
74 source->AddLocalizedString("signInButton", IDS_MD_HISTORY_SIGN_IN_BUTTON); | 76 source->AddLocalizedString("signInButton", IDS_MD_HISTORY_SIGN_IN_BUTTON); |
75 source->AddLocalizedString("signInPromo", IDS_MD_HISTORY_SIGN_IN_PROMO); | 77 source->AddLocalizedString("signInPromo", IDS_MD_HISTORY_SIGN_IN_PROMO); |
76 source->AddLocalizedString("signInPromoDesc", | 78 source->AddLocalizedString("signInPromoDesc", |
77 IDS_MD_HISTORY_SIGN_IN_PROMO_DESC); | 79 IDS_MD_HISTORY_SIGN_IN_PROMO_DESC); |
78 source->AddLocalizedString("title", IDS_HISTORY_TITLE); | 80 source->AddLocalizedString("title", IDS_HISTORY_TITLE); |
79 | 81 |
| 82 source->AddString( |
| 83 "footer", |
| 84 l10n_util::GetStringFUTF16( |
| 85 IDS_HISTORY_OTHER_FORMS_OF_HISTORY, |
| 86 l10n_util::GetStringUTF16( |
| 87 IDS_SETTINGS_CLEAR_DATA_WEB_HISTORY_URL_IN_HISTORY))); |
| 88 |
80 bool allow_deleting_history = | 89 bool allow_deleting_history = |
81 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); | 90 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); |
82 source->AddBoolean("allowDeletingHistory", allow_deleting_history); | 91 source->AddBoolean("allowDeletingHistory", allow_deleting_history); |
83 | 92 |
84 bool group_by_domain = base::CommandLine::ForCurrentProcess()->HasSwitch( | 93 bool group_by_domain = base::CommandLine::ForCurrentProcess()->HasSwitch( |
85 switches::kHistoryEnableGroupByDomain) || profile->IsSupervised(); | 94 switches::kHistoryEnableGroupByDomain) || profile->IsSupervised(); |
86 source->AddBoolean("groupByDomain", group_by_domain); | 95 source->AddBoolean("groupByDomain", group_by_domain); |
87 | 96 |
88 SigninManagerBase* signin_manager = | 97 SigninManagerBase* signin_manager = |
89 SigninManagerFactory::GetForProfile(profile); | 98 SigninManagerFactory::GetForProfile(profile); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 base::FeatureList::ClearInstanceForTesting(); | 186 base::FeatureList::ClearInstanceForTesting(); |
178 base::FeatureList::SetInstance(std::move(feature_list)); | 187 base::FeatureList::SetInstance(std::move(feature_list)); |
179 } | 188 } |
180 | 189 |
181 // static | 190 // static |
182 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( | 191 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( |
183 ui::ScaleFactor scale_factor) { | 192 ui::ScaleFactor scale_factor) { |
184 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 193 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
185 IDR_HISTORY_FAVICON, scale_factor); | 194 IDR_HISTORY_FAVICON, scale_factor); |
186 } | 195 } |
OLD | NEW |