Index: ios/chrome/browser/ui/webui/history/history_ui.mm |
diff --git a/ios/chrome/browser/ui/webui/history/history_ui.cc b/ios/chrome/browser/ui/webui/history/history_ui.mm |
similarity index 88% |
rename from ios/chrome/browser/ui/webui/history/history_ui.cc |
rename to ios/chrome/browser/ui/webui/history/history_ui.mm |
index aa00f0586baf2e1cc81c3680768e12678844e9f5..1d798b5b61bfea585446c76132e216ba3ac52894 100644 |
--- a/ios/chrome/browser/ui/webui/history/history_ui.cc |
+++ b/ios/chrome/browser/ui/webui/history/history_ui.mm |
@@ -8,19 +8,23 @@ |
#include "base/memory/ref_counted_memory.h" |
#include "base/strings/string16.h" |
#include "base/strings/utf_string_conversions.h" |
+#include "components/browsing_data_ui/history_notice_utils.h" |
#include "components/grit/components_scaled_resources.h" |
#include "components/keyed_service/core/service_access_type.h" |
+#include "components/prefs/pref_service.h" |
#include "components/search/search.h" |
#include "components/signin/core/browser/signin_manager.h" |
#include "components/strings/grit/components_strings.h" |
#include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
#include "ios/chrome/browser/chrome_switches.h" |
#include "ios/chrome/browser/chrome_url_constants.h" |
+#include "ios/chrome/browser/pref_names.h" |
#include "ios/chrome/browser/signin/signin_manager_factory.h" |
#include "ios/chrome/browser/ui/webui/history/browsing_history_handler.h" |
#include "ios/chrome/browser/ui/webui/history/metrics_handler.h" |
#include "ios/chrome/grit/ios_resources.h" |
#include "ios/public/provider/web/web_ui_ios.h" |
+#include "ios/web/public/web_state/web_state.h" |
#include "ios/web/public/web_ui_ios_data_source.h" |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/base/resource/resource_bundle.h" |
@@ -132,6 +136,20 @@ HistoryUI::HistoryUI(web::WebUIIOS* web_ui) : web::WebUIIOSController(web_ui) { |
web_ui->AddMessageHandler(new BrowsingHistoryHandler()); |
web_ui->AddMessageHandler(new MetricsHandler()); |
+ // TODO(crbug.com/595332): Since the API to query other forms of browsing |
+ // history is not ready yet, make it possible to test the history UI as if |
+ // it were. If the user opens chrome://history/?reset_ofbh, we will assume |
+ // that other forms of browsing history exist (for all accounts), and we will |
+ // also reset the one-time notice shown in the Clear Browsing Data dialog. |
+ // This code should be removed as soon as the API is ready. |
+ GURL url = web_ui->GetWebState()->GetVisibleURL(); |
+ if (url.has_query() && url.query() == "reset_ofbh") { |
+ ios::ChromeBrowserState::FromWebUIIOS(web_ui)->GetPrefs()->SetInteger( |
+ prefs::kClearBrowsingDataHistoryNoticeShownTimes, 0); |
+ browsing_data_ui::testing:: |
+ g_override_other_forms_of_browsing_history_query = true; |
+ } |
+ |
// Set up the chrome://history-frame/ source. |
ios::ChromeBrowserState* browser_state = |
ios::ChromeBrowserState::FromWebUIIOS(web_ui); |