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

Side by Side Diff: chrome/browser/chromeos/login/dom_login_display.cc

Issue 6973029: Integrate WebUI Login with cros. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated code in response to review comments Created 9 years, 7 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/dom_login_display.h" 5 #include "chrome/browser/chromeos/login/dom_login_display.h"
6 6
7 #include "chrome/browser/chromeos/frame/dom_browser.h"
8 #include "chrome/browser/chromeos/wm_ipc.h" 7 #include "chrome/browser/chromeos/wm_ipc.h"
9 #include "chrome/browser/profiles/profile_manager.h" 8 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/ui/browser_window.h" 9 #include "chrome/browser/ui/browser_window.h"
10 #include "views/widget/widget.h"
11 11
12 namespace { 12 namespace {
13 const char kLoginURL[] = "chrome://login"; 13 const char kLoginURL[] = "chrome://login";
14 } // namespace 14 } // namespace
15 15
16 namespace chromeos { 16 namespace chromeos {
17 17
18 // DOMLoginDisplay, public: --------------------------------------------------- 18 // DOMLoginDisplay, public: ---------------------------------------------------
19 19
20 DOMLoginDisplay::~DOMLoginDisplay() { 20 DOMLoginDisplay::~DOMLoginDisplay() {
21 if (login_screen_) 21 if (webui_login_window_)
22 login_screen_->CloseWindow(); 22 webui_login_window_->Close();
23 } 23 }
24 24
25 // DOMLoginDisplay, Singleton implementation: ---------------------------------- 25 // DOMLoginDisplay, Singleton implementation: ----------------------------------
26 26
27 // static 27 // static
28 DOMLoginDisplay* DOMLoginDisplay::GetInstance() { 28 DOMLoginDisplay* DOMLoginDisplay::GetInstance() {
29 return Singleton<DOMLoginDisplay>::get(); 29 return Singleton<DOMLoginDisplay>::get();
30 } 30 }
31 31
32 // LoginDisplay implementation: ------------------------------------------------ 32 // LoginDisplay implementation: ------------------------------------------------
33 33
34 // static
35 views::Widget* DOMLoginDisplay::GetCurrentLoginWindow() {
36 return DOMLoginDisplay::GetInstance()->LoginWindow();
37 }
38
39 views::Widget* DOMLoginDisplay::LoginWindow() {
40 return webui_login_window_;
41 }
42
34 void DOMLoginDisplay::Destroy() { 43 void DOMLoginDisplay::Destroy() {
35 background_bounds_ = gfx::Rect(); 44 background_bounds_ = gfx::Rect();
36 delegate_ = NULL; 45 delegate_ = NULL;
46
47 if (webui_login_window_) {
48 webui_login_window_->Close();
49 }
oshima 2011/05/19 01:45:19 nuke {}
rharrison 2011/05/19 16:45:28 Done.
50
51 webui_login_window_ = NULL;
52 webui_login_view_ = NULL;
37 } 53 }
38 54
39 void DOMLoginDisplay::Init(const std::vector<UserManager::User>& users, 55 void DOMLoginDisplay::Init(const std::vector<UserManager::User>& users,
40 bool show_guest, 56 bool show_guest,
41 bool show_new_user) { 57 bool show_new_user) {
42 // Testing that the delegate has been set. 58 // Testing that the delegate has been set.
43 DCHECK(delegate_); 59 DCHECK(delegate_);
44 users_ = users; 60 users_ = users;
45 61
46 // TODO(rharrison): Add mechanism to pass in the show_guest and show_new_user 62 // TODO(rharrison): Add mechanism to pass in the show_guest and show_new_user
47 // values. 63 // values.
48 login_screen_ = DOMBrowser::CreateForDOM(ProfileManager::GetDefaultProfile()); 64 webui_login_window_ = WebUILoginView::CreateWindowContainingView(
49 login_screen_->AddSelectedTabWithURL(GURL(kLoginURL), 65 background_bounds_,
50 PageTransition::START_PAGE); 66 GURL(kLoginURL),
51 login_screen_->window()->Show(); 67 &webui_login_view_);
68 webui_login_window_->Show();
52 } 69 }
53 70
54 void DOMLoginDisplay::OnBeforeUserRemoved(const std::string& username) { 71 void DOMLoginDisplay::OnBeforeUserRemoved(const std::string& username) {
55 // TODO(rharrison): Figure out if I need to split anything between this and 72 // TODO(rharrison): Figure out if I need to split anything between this and
56 // OnUserRemoved 73 // OnUserRemoved
57 } 74 }
58 75
59 void DOMLoginDisplay::OnUserImageChanged(UserManager::User* user) { 76 void DOMLoginDisplay::OnUserImageChanged(UserManager::User* user) {
60 // TODO(rharrison): Update the user in the user vector 77 // TODO(rharrison): Update the user in the user vector
61 // TODO(rharrison): Push the change to DOM Login screen 78 // TODO(rharrison): Push the change to DOM Login screen
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 delegate_->LoginAsGuest(); 114 delegate_->LoginAsGuest();
98 } 115 }
99 116
100 // DOMLoginDisplay, private: --------------------------------------------------- 117 // DOMLoginDisplay, private: ---------------------------------------------------
101 118
102 // Singleton implementation: --------------------------------------------------- 119 // Singleton implementation: ---------------------------------------------------
103 120
104 DOMLoginDisplay::DOMLoginDisplay() 121 DOMLoginDisplay::DOMLoginDisplay()
105 : LoginDisplay(NULL, gfx::Rect()), 122 : LoginDisplay(NULL, gfx::Rect()),
106 LoginUIHandlerDelegate(), 123 LoginUIHandlerDelegate(),
107 login_screen_(NULL) {} 124 webui_login_window_(NULL) {
oshima 2011/05/19 01:45:19 webui_login_view_(NULL)
rharrison 2011/05/19 16:45:28 Done.
125
oshima 2011/05/19 01:45:19 remove empty line
rharrison 2011/05/19 16:45:28 Done.
126 }
127
108 128
109 } // namespace chromeos 129 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698