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

Side by Side Diff: chrome/browser/chromeos/login/webui_screen_locker.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/webui_screen_locker.h" 5 #include "chrome/browser/chromeos/login/webui_screen_locker.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chromeos/cros/cros_library.h" 10 #include "chrome/browser/chromeos/cros/cros_library.h"
11 #include "chrome/browser/chromeos/cros/network_library.h" 11 #include "chrome/browser/chromeos/cros/network_library.h"
12 #include "chrome/browser/chromeos/login/helper.h" 12 #include "chrome/browser/chromeos/login/helper.h"
13 #include "chrome/browser/chromeos/login/screen_locker.h" 13 #include "chrome/browser/chromeos/login/screen_locker.h"
14 #include "chrome/browser/chromeos/login/user_manager.h" 14 #include "chrome/browser/chromeos/login/user_manager.h"
15 #include "chrome/browser/chromeos/login/webui_login_display.h" 15 #include "chrome/browser/chromeos/login/webui_login_display.h"
16 #include "chrome/browser/ui/views/dom_view.h" 16 #include "chrome/browser/ui/views/dom_view.h"
17 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 17 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
18 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
19 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
20 #include "content/browser/renderer_host/render_widget_host_view.h" 20 #include "content/browser/renderer_host/render_widget_host_view.h"
21 #include "content/browser/webui/web_ui.h"
21 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/notification_types.h" 23 #include "content/public/browser/notification_types.h"
23 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/x/x11_util.h" 25 #include "ui/base/x/x11_util.h"
25 #include "ui/gfx/screen.h" 26 #include "ui/gfx/screen.h"
26 27
27 namespace { 28 namespace {
28 29
29 // URL which corresponds to the login WebUI. 30 // URL which corresponds to the login WebUI.
30 const char kLoginURL[] = "chrome://oobe/login"; 31 const char kLoginURL[] = "chrome://oobe/login";
(...skipping 23 matching lines...) Expand all
54 OnWindowCreated(); 55 OnWindowCreated();
55 LoadURL(GURL(kLoginURL)); 56 LoadURL(GURL(kLoginURL));
56 lock_window->Grab(webui_login_); 57 lock_window->Grab(webui_login_);
57 58
58 // User list consisting of a single logged-in user. 59 // User list consisting of a single logged-in user.
59 UserList users(1, &chromeos::UserManager::Get()->logged_in_user()); 60 UserList users(1, &chromeos::UserManager::Get()->logged_in_user());
60 login_display_.reset(new WebUILoginDisplay(this)); 61 login_display_.reset(new WebUILoginDisplay(this));
61 login_display_->set_background_bounds(bounds); 62 login_display_->set_background_bounds(bounds);
62 login_display_->Init(users, false, true, false); 63 login_display_->Init(users, false, true, false);
63 64
64 static_cast<OobeUI*>(GetWebUI())->ShowSigninScreen(login_display_.get()); 65 static_cast<OobeUI*>(GetWebUI()->GetController())->ShowSigninScreen(
66 login_display_.get());
65 67
66 registrar_.Add(this, 68 registrar_.Add(this,
67 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, 69 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED,
68 content::NotificationService::AllSources()); 70 content::NotificationService::AllSources());
69 registrar_.Add(this, 71 registrar_.Add(this,
70 chrome::NOTIFICATION_LOCK_WEBUI_READY, 72 chrome::NOTIFICATION_LOCK_WEBUI_READY,
71 content::NotificationService::AllSources()); 73 content::NotificationService::AllSources());
72 } 74 }
73 75
74 void WebUIScreenLocker::ScreenLockReady() { 76 void WebUIScreenLocker::ScreenLockReady() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 114
113 void WebUIScreenLocker::ClearErrors() { 115 void WebUIScreenLocker::ClearErrors() {
114 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); 116 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.clearErrors");
115 } 117 }
116 118
117 WebUIScreenLocker::~WebUIScreenLocker() { 119 WebUIScreenLocker::~WebUIScreenLocker() {
118 DCHECK(lock_window_); 120 DCHECK(lock_window_);
119 lock_window_->Close(); 121 lock_window_->Close();
120 // If LockScreen() was called, we need to clear the signin screen handler 122 // If LockScreen() was called, we need to clear the signin screen handler
121 // delegate set in ShowSigninScreen so that it no longer points to us. 123 // delegate set in ShowSigninScreen so that it no longer points to us.
122 if (login_display_.get()) 124 if (login_display_.get()) {
123 static_cast<OobeUI*>(GetWebUI())->ResetSigninScreenHandlerDelegate(); 125 static_cast<OobeUI*>(GetWebUI()->GetController())->
126 ResetSigninScreenHandlerDelegate();
127 }
124 SetStatusAreaEnabled(true); 128 SetStatusAreaEnabled(true);
125 } 129 }
126 130
127 //////////////////////////////////////////////////////////////////////////////// 131 ////////////////////////////////////////////////////////////////////////////////
128 // WebUIScreenLocker, content::NotificationObserver implementation: 132 // WebUIScreenLocker, content::NotificationObserver implementation:
129 133
130 void WebUIScreenLocker::Observe( 134 void WebUIScreenLocker::Observe(
131 int type, 135 int type,
132 const content::NotificationSource& source, 136 const content::NotificationSource& source,
133 const content::NotificationDetails& details) { 137 const content::NotificationDetails& details) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 203 }
200 204
201 //////////////////////////////////////////////////////////////////////////////// 205 ////////////////////////////////////////////////////////////////////////////////
202 // Overridden from WebUILoginView: 206 // Overridden from WebUILoginView:
203 207
204 views::Widget::InitParams::Type WebUIScreenLocker::GetStatusAreaWidgetType() { 208 views::Widget::InitParams::Type WebUIScreenLocker::GetStatusAreaWidgetType() {
205 return views::Widget::InitParams::TYPE_POPUP; 209 return views::Widget::InitParams::TYPE_POPUP;
206 } 210 }
207 211
208 } // namespace chromeos 212 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698