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

Unified Diff: chrome/browser/ui/webui/workers_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/workers_ui.cc
===================================================================
--- chrome/browser/ui/webui/workers_ui.cc (revision 117871)
+++ chrome/browser/ui/webui/workers_ui.cc (working copy)
@@ -16,8 +16,9 @@
#include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
#include "chrome/common/url_constants.h"
+#include "content/browser/webui/web_ui.h"
+#include "content/browser/worker_host/worker_process_host.h"
#include "content/public/browser/devtools_agent_host_registry.h"
-#include "content/browser/worker_host/worker_process_host.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/worker_service.h"
@@ -233,13 +234,17 @@
virtual void WorkerContextStarted(WorkerProcessHost*, int) OVERRIDE {}
void NotifyWorkerCreated(DictionaryValue* worker_data) {
- if (workers_ui_)
- workers_ui_->CallJavascriptFunction("workerCreated", *worker_data);
+ if (!workers_ui_) {
+ workers_ui_->web_ui()->CallJavascriptFunction(
+ "workerCreated", *worker_data);
+ }
}
void NotifyWorkerDestroyed(DictionaryValue* worker_data) {
- if (workers_ui_)
- workers_ui_->CallJavascriptFunction("workerDestroyed", *worker_data);
+ if (workers_ui_) {
+ workers_ui_->web_ui()->CallJavascriptFunction(
+ "workerDestroyed", *worker_data);
+ }
}
void RegisterObserver() {
@@ -252,15 +257,16 @@
WorkersUI* workers_ui_;
};
-WorkersUI::WorkersUI(WebContents* contents)
- : WebUI(contents, this),
+WorkersUI::WorkersUI(WebUI* web_ui)
+ : WebUIController(web_ui),
observer_(new WorkerCreationDestructionListener(this)){
- AddMessageHandler(new WorkersDOMHandler());
+ web_ui->AddMessageHandler(new WorkersDOMHandler());
WorkersUIHTMLSource* html_source = new WorkersUIHTMLSource();
// Set up the chrome://workers/ source.
- Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
+ Profile* profile = Profile::FromBrowserContext(
+ web_ui->web_contents()->GetBrowserContext());
profile->GetChromeURLDataManager()->AddDataSource(html_source);
}

Powered by Google App Engine
This is Rietveld 408576698