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

Unified Diff: chrome/browser/ui/webui/chromeos/mobile_setup_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/chromeos/mobile_setup_ui.cc
===================================================================
--- chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc (revision 117871)
+++ chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc (working copy)
@@ -32,6 +32,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
+#include "content/browser/webui/web_ui.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host_observer.h"
#include "content/public/browser/web_contents.h"
@@ -156,15 +157,16 @@
return;
base::FundamentalValue result_value(error);
- parent_->CallJavascriptFunction(kJsPortalFrameLoadFailedCallback,
- result_value);
+ parent_->web_ui()->CallJavascriptFunction(kJsPortalFrameLoadFailedCallback,
+ result_value);
}
void OnFrameLoadCompleted() {
if (!parent_.get())
return;
- parent_->CallJavascriptFunction(kJsPortalFrameLoadCompletedCallback);
+ parent_->web_ui()->CallJavascriptFunction(
+ kJsPortalFrameLoadCompletedCallback);
}
base::WeakPtr<MobileSetupUI> parent_;
@@ -1389,17 +1391,18 @@
//
////////////////////////////////////////////////////////////////////////////////
-MobileSetupUI::MobileSetupUI(WebContents* contents)
- : WebUI(contents, this),
+MobileSetupUI::MobileSetupUI(WebUI* web_ui)
+ : WebUIController(web_ui),
frame_load_observer_(NULL) {
chromeos::CellularNetwork* network = GetCellularNetwork();
std::string service_path = network ? network->service_path() : std::string();
- AddMessageHandler(new MobileSetupHandler(service_path));
+ web_ui->AddMessageHandler(new MobileSetupHandler(service_path));
MobileSetupUIHTMLSource* html_source =
new MobileSetupUIHTMLSource(service_path);
// Set up the chrome://mobilesetup/ 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