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

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

Issue 12377095: Add "clear" to about://instant. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 7 years, 10 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 | « chrome/browser/resources/instant/instant.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/instant_ui.cc
diff --git a/chrome/browser/ui/webui/instant_ui.cc b/chrome/browser/ui/webui/instant_ui.cc
index 8a609208f199761219eec47c7d803c8548635a45..7008a227ae12da4003dc8692fafaeb047e5f5834 100644
--- a/chrome/browser/ui/webui/instant_ui.cc
+++ b/chrome/browser/ui/webui/instant_ui.cc
@@ -58,6 +58,7 @@ class InstantUIMessageHandler
void GetPreferenceValue(const base::ListValue* args);
void SetPreferenceValue(const base::ListValue* args);
void GetDebugInfo(const base::ListValue* value);
+ void ClearDebugInfo(const base::ListValue* value);
DISALLOW_COPY_AND_ASSIGN(InstantUIMessageHandler);
};
@@ -79,6 +80,10 @@ void InstantUIMessageHandler::RegisterMessages() {
"getDebugInfo",
base::Bind(&InstantUIMessageHandler::GetDebugInfo,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "clearDebugInfo",
+ base::Bind(&InstantUIMessageHandler::ClearDebugInfo,
+ base::Unretained(this)));
}
void InstantUIMessageHandler::GetPreferenceValue(const base::ListValue* args) {
@@ -136,6 +141,19 @@ void InstantUIMessageHandler::GetDebugInfo(const base::ListValue* args) {
#endif
}
+void InstantUIMessageHandler::ClearDebugInfo(const base::ListValue* args) {
+#if !defined(OS_ANDROID)
+ if (!web_ui()->GetWebContents())
+ return;
+ Browser* browser = chrome::FindBrowserWithWebContents(
+ web_ui()->GetWebContents());
+ if (!browser || !browser->instant_controller())
+ return;
+
+ browser->instant_controller()->instant()->ClearDebugEvents();
+#endif
+}
+
} // namespace
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « chrome/browser/resources/instant/instant.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698