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

Unified Diff: chrome/browser/ui/webui/chromeos/login/oobe_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/login/oobe_ui.cc
===================================================================
--- chrome/browser/ui/webui/chromeos/login/oobe_ui.cc (revision 117871)
+++ chrome/browser/ui/webui/chromeos/login/oobe_ui.cc (working copy)
@@ -31,6 +31,7 @@
#include "chrome/browser/ui/webui/theme_source.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/url_constants.h"
+#include "content/browser/webui/web_ui.h"
#include "content/public/browser/web_contents.h"
#include "grit/browser_resources.h"
#include "ui/base/resource/resource_bundle.h"
@@ -108,8 +109,8 @@
// OobeUI ----------------------------------------------------------------------
-OobeUI::OobeUI(WebContents* contents)
- : WebUI(contents, this),
+OobeUI::OobeUI(WebUI* web_ui)
+ : WebUIController(web_ui),
update_screen_actor_(NULL),
network_screen_actor_(NULL),
eula_screen_actor_(NULL),
@@ -150,7 +151,8 @@
DictionaryValue* localized_strings = new DictionaryValue();
GetLocalizedStrings(localized_strings);
- Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
+ Profile* profile = Profile::FromBrowserContext(
+ web_ui->web_contents()->GetBrowserContext());
// Set up the chrome://theme/ source, for Chrome logo.
ThemeSource* theme = new ThemeSource(profile);
profile->GetChromeURLDataManager()->AddDataSource(theme);
@@ -212,22 +214,19 @@
void OobeUI::GetLocalizedStrings(base::DictionaryValue* localized_strings) {
// Note, handlers_[0] is a GenericHandler used by the WebUI.
- for (size_t i = 1; i < handlers_.size(); ++i) {
- static_cast<BaseScreenHandler*>(handlers_[i])->
- GetLocalizedStrings(localized_strings);
- }
+ for (size_t i = 0; i < handlers_.size(); ++i)
+ handlers_[i]->GetLocalizedStrings(localized_strings);
ChromeURLDataManager::DataSource::SetFontAndTextDirection(localized_strings);
}
void OobeUI::AddScreenHandler(BaseScreenHandler* handler) {
- AddMessageHandler(handler);
+ web_ui()->AddMessageHandler(handler);
+ handlers_.push_back(handler);
}
void OobeUI::InitializeHandlers() {
- // Note, handlers_[0] is a GenericHandler used by the WebUI.
- for (size_t i = 1; i < handlers_.size(); ++i) {
- static_cast<BaseScreenHandler*>(handlers_[i])->InitializeBase();
- }
+ for (size_t i = 0; i < handlers_.size(); ++i)
+ handlers_[i]->InitializeBase();
}
void OobeUI::ShowOobeUI(bool show) {

Powered by Google App Engine
This is Rietveld 408576698