Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(773)

Unified Diff: chrome/browser/ui/webui/history_ui.cc

Issue 1884553002: Add a testing switch to override the query for other forms of browsing history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/browsing_data_ui/history_notice_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/history_ui.cc
diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc
index 1da50656d6a4206a2dcb14f2069ecc2f816719b9..1f2b03f1ca743b949b31c4e4e0d9f67c5ee5b51f 100644
--- a/chrome/browser/ui/webui/history_ui.cc
+++ b/chrome/browser/ui/webui/history_ui.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/ui/webui/history_ui.h"
+#include <string>
+
#include "base/command_line.h"
#include "base/memory/ref_counted_memory.h"
#include "base/strings/string16.h"
@@ -18,9 +20,11 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
+#include "components/browsing_data_ui/history_notice_utils.h"
#include "components/prefs/pref_service.h"
#include "components/search/search.h"
#include "components/signin/core/browser/signin_manager.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "grit/browser_resources.h"
@@ -173,6 +177,19 @@ HistoryUI::HistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) {
}
#endif
+ // 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->GetWebContents()->GetVisibleURL();
+ if (url.has_query() && url.query() == "reset_ofbh") {
+ Profile::FromWebUI(web_ui)->GetPrefs()->SetInteger(
+ prefs::kClearBrowsingDataHistoryNoticeShownTimes, 0);
+ browsing_data_ui::testing::kOverrideOtherFormsOfBrowsingHistoryQuery = true;
Dan Beam 2016/04/21 03:12:55 this is a constant naming form (kConstantThing) t
msramek 2016/04/21 08:50:30 Done.
+ }
+
// Set up the chrome://history-frame/ source.
Profile* profile = Profile::FromWebUI(web_ui);
content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile));
« no previous file with comments | « no previous file | components/browsing_data_ui/history_notice_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698