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

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

Issue 9224002: Make WebUI objects not derive from WebUI. WebUI objects own the controller. This is the ownership... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync to head to clear linux_chromeos browsertest failures Created 8 years, 11 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
Index: chrome/browser/ui/webui/profiler_ui.cc
===================================================================
--- chrome/browser/ui/webui/profiler_ui.cc (revision 117871)
+++ chrome/browser/ui/webui/profiler_ui.cc (working copy)
@@ -20,6 +20,7 @@
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
#include "chrome/common/url_constants.h"
#include "content/browser/trace_controller.h"
+#include "content/browser/webui/web_ui.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui_message_handler.h"
@@ -144,14 +145,14 @@
} // namespace
-ProfilerUI::ProfilerUI(WebContents* contents) : WebUI(contents, this) {
+ProfilerUI::ProfilerUI(WebUI* web_ui) : WebUIController(web_ui) {
ui_weak_ptr_factory_.reset(new base::WeakPtrFactory<ProfilerUI>(this));
ui_weak_ptr_ = ui_weak_ptr_factory_->GetWeakPtr();
- AddMessageHandler(new ProfilerMessageHandler());
+ web_ui->AddMessageHandler(new ProfilerMessageHandler());
// Set up the chrome://profiler/ source.
- Profile::FromBrowserContext(contents->GetBrowserContext())->
+ Profile::FromBrowserContext(web_ui->web_contents()->GetBrowserContext())->
GetChromeURLDataManager()->AddDataSource(CreateProfilerHTMLSource());
}
@@ -165,6 +166,7 @@
void ProfilerUI::ReceivedData(base::Value* value) {
// Send the data to the renderer.
scoped_ptr<Value> data_values(value);
- CallJavascriptFunction("g_browserBridge.receivedData", *data_values.get());
+ web_ui()->CallJavascriptFunction(
+ "g_browserBridge.receivedData", *data_values.get());
}

Powered by Google App Engine
This is Rietveld 408576698