| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/ui/webui/history/history_ui.h" | 5 #include "ios/chrome/browser/ui/webui/history/history_ui.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "components/browsing_data_ui/history_notice_utils.h" | 11 #include "components/browsing_data/core/history_notice_utils.h" |
| 12 #include "components/grit/components_scaled_resources.h" | 12 #include "components/grit/components_scaled_resources.h" |
| 13 #include "components/keyed_service/core/service_access_type.h" | 13 #include "components/keyed_service/core/service_access_type.h" |
| 14 #include "components/prefs/pref_service.h" | 14 #include "components/prefs/pref_service.h" |
| 15 #include "components/search/search.h" | 15 #include "components/search/search.h" |
| 16 #include "components/signin/core/browser/signin_manager.h" | 16 #include "components/signin/core/browser/signin_manager.h" |
| 17 #include "components/strings/grit/components_strings.h" | 17 #include "components/strings/grit/components_strings.h" |
| 18 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 18 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 19 #include "ios/chrome/browser/chrome_switches.h" | 19 #include "ios/chrome/browser/chrome_switches.h" |
| 20 #include "ios/chrome/browser/chrome_url_constants.h" | 20 #include "ios/chrome/browser/chrome_url_constants.h" |
| 21 #include "ios/chrome/browser/pref_names.h" | 21 #include "ios/chrome/browser/pref_names.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // TODO(crbug.com/595332): Since the API to query other forms of browsing | 139 // TODO(crbug.com/595332): Since the API to query other forms of browsing |
| 140 // history is not ready yet, make it possible to test the history UI as if | 140 // history is not ready yet, make it possible to test the history UI as if |
| 141 // it were. If the user opens chrome://history/?reset_ofbh, we will assume | 141 // it were. If the user opens chrome://history/?reset_ofbh, we will assume |
| 142 // that other forms of browsing history exist (for all accounts), and we will | 142 // that other forms of browsing history exist (for all accounts), and we will |
| 143 // also reset the one-time notice shown in the Clear Browsing Data dialog. | 143 // also reset the one-time notice shown in the Clear Browsing Data dialog. |
| 144 // This code should be removed as soon as the API is ready. | 144 // This code should be removed as soon as the API is ready. |
| 145 GURL url = web_ui->GetWebState()->GetVisibleURL(); | 145 GURL url = web_ui->GetWebState()->GetVisibleURL(); |
| 146 if (url.has_query() && url.query() == "reset_ofbh") { | 146 if (url.has_query() && url.query() == "reset_ofbh") { |
| 147 ios::ChromeBrowserState::FromWebUIIOS(web_ui)->GetPrefs()->SetInteger( | 147 ios::ChromeBrowserState::FromWebUIIOS(web_ui)->GetPrefs()->SetInteger( |
| 148 prefs::kClearBrowsingDataHistoryNoticeShownTimes, 0); | 148 prefs::kClearBrowsingDataHistoryNoticeShownTimes, 0); |
| 149 browsing_data_ui::testing:: | 149 browsing_data::testing::g_override_other_forms_of_browsing_history_query = |
| 150 g_override_other_forms_of_browsing_history_query = true; | 150 true; |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Set up the chrome://history-frame/ source. | 153 // Set up the chrome://history-frame/ source. |
| 154 ios::ChromeBrowserState* browser_state = | 154 ios::ChromeBrowserState* browser_state = |
| 155 ios::ChromeBrowserState::FromWebUIIOS(web_ui); | 155 ios::ChromeBrowserState::FromWebUIIOS(web_ui); |
| 156 web::WebUIIOSDataSource::Add(browser_state, | 156 web::WebUIIOSDataSource::Add(browser_state, |
| 157 CreateHistoryUIHTMLSource(browser_state)); | 157 CreateHistoryUIHTMLSource(browser_state)); |
| 158 } | 158 } |
| 159 | 159 |
| 160 HistoryUI::~HistoryUI() {} | 160 HistoryUI::~HistoryUI() {} |
| 161 | 161 |
| 162 // static | 162 // static |
| 163 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( | 163 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( |
| 164 ui::ScaleFactor scale_factor) { | 164 ui::ScaleFactor scale_factor) { |
| 165 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 165 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
| 166 IDR_HISTORY_FAVICON, scale_factor); | 166 IDR_HISTORY_FAVICON, scale_factor); |
| 167 } | 167 } |
| OLD | NEW |