OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/history_ui.h" | 5 #include "chrome/browser/ui/webui/history_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 14 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/signin/signin_manager_factory.h" | 16 #include "chrome/browser/signin/signin_manager_factory.h" |
17 #include "chrome/browser/ui/webui/browsing_history_handler.h" | 17 #include "chrome/browser/ui/webui/browsing_history_handler.h" |
18 #include "chrome/browser/ui/webui/metrics_handler.h" | 18 #include "chrome/browser/ui/webui/metrics_handler.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
21 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
22 #include "chrome/grit/browser_resources.h" | 22 #include "chrome/grit/browser_resources.h" |
23 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
24 #include "chrome/grit/theme_resources.h" | 24 #include "chrome/grit/theme_resources.h" |
| 25 #include "components/browsing_data/core/history_notice_utils.h" |
25 #include "components/browsing_data/core/pref_names.h" | 26 #include "components/browsing_data/core/pref_names.h" |
26 #include "components/browsing_data_ui/history_notice_utils.h" | |
27 #include "components/grit/components_scaled_resources.h" | 27 #include "components/grit/components_scaled_resources.h" |
28 #include "components/prefs/pref_service.h" | 28 #include "components/prefs/pref_service.h" |
29 #include "components/search/search.h" | 29 #include "components/search/search.h" |
30 #include "components/signin/core/browser/signin_manager.h" | 30 #include "components/signin/core/browser/signin_manager.h" |
31 #include "components/strings/grit/components_strings.h" | 31 #include "components/strings/grit/components_strings.h" |
32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
33 #include "content/public/browser/web_ui.h" | 33 #include "content/public/browser/web_ui.h" |
34 #include "content/public/browser/web_ui_data_source.h" | 34 #include "content/public/browser/web_ui_data_source.h" |
35 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
36 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // TODO(crbug.com/595332): Since the API to query other forms of browsing | 187 // TODO(crbug.com/595332): Since the API to query other forms of browsing |
188 // history is not ready yet, make it possible to test the history UI as if | 188 // history is not ready yet, make it possible to test the history UI as if |
189 // it were. If the user opens chrome://history/?reset_ofbh, we will assume | 189 // it were. If the user opens chrome://history/?reset_ofbh, we will assume |
190 // that other forms of browsing history exist (for all accounts), and we will | 190 // that other forms of browsing history exist (for all accounts), and we will |
191 // also reset the one-time notice shown in the Clear Browsing Data dialog. | 191 // also reset the one-time notice shown in the Clear Browsing Data dialog. |
192 // This code should be removed as soon as the API is ready. | 192 // This code should be removed as soon as the API is ready. |
193 GURL url = web_ui->GetWebContents()->GetVisibleURL(); | 193 GURL url = web_ui->GetWebContents()->GetVisibleURL(); |
194 if (url.has_query() && url.query() == "reset_ofbh") { | 194 if (url.has_query() && url.query() == "reset_ofbh") { |
195 Profile::FromWebUI(web_ui)->GetPrefs()->SetInteger( | 195 Profile::FromWebUI(web_ui)->GetPrefs()->SetInteger( |
196 browsing_data::prefs::kClearBrowsingDataHistoryNoticeShownTimes, 0); | 196 browsing_data::prefs::kClearBrowsingDataHistoryNoticeShownTimes, 0); |
197 browsing_data_ui::testing:: | 197 browsing_data::testing:: |
198 g_override_other_forms_of_browsing_history_query = true; | 198 g_override_other_forms_of_browsing_history_query = true; |
199 } | 199 } |
200 | 200 |
201 // Set up the chrome://history-frame/ source. | 201 // Set up the chrome://history-frame/ source. |
202 Profile* profile = Profile::FromWebUI(web_ui); | 202 Profile* profile = Profile::FromWebUI(web_ui); |
203 content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile)); | 203 content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile)); |
204 } | 204 } |
205 | 205 |
206 HistoryUI::~HistoryUI() {} | 206 HistoryUI::~HistoryUI() {} |
207 | 207 |
208 // static | 208 // static |
209 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( | 209 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( |
210 ui::ScaleFactor scale_factor) { | 210 ui::ScaleFactor scale_factor) { |
211 return ResourceBundle::GetSharedInstance(). | 211 return ResourceBundle::GetSharedInstance(). |
212 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); | 212 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); |
213 } | 213 } |
OLD | NEW |