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

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: Implemented login screen using widget 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_.get())
22 login_screen_->CloseWindow(); 22 webui_login_window_->Close();
oshima 2011/05/18 18:24:54 if you want to keep scoped_ptr, you have to releas
rharrison 2011/05/19 00:31:43 Removed the scoped ptr
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
Ben Goodger (Google) 2011/05/18 16:50:51 nit: delete the empty line
rharrison 2011/05/19 00:31:43 Done.
37 return DOMLoginDisplay::GetInstance()->LoginWindow();
38 }
39
34 void DOMLoginDisplay::Destroy() { 40 void DOMLoginDisplay::Destroy() {
35 background_bounds_ = gfx::Rect(); 41 background_bounds_ = gfx::Rect();
36 delegate_ = NULL; 42 delegate_ = NULL;
43
44 webui_login_window_.reset(NULL);
Ben Goodger (Google) 2011/05/18 16:50:51 nit: reset() works
oshima 2011/05/18 18:24:54 Don't you have to Close it?
rharrison 2011/05/19 00:31:43 This correct, my mistake.
rharrison 2011/05/19 00:31:43 I changed this to a normal pointer instead of a sc
45 webui_login_view_ = NULL;
37 } 46 }
38 47
39 void DOMLoginDisplay::Init(const std::vector<UserManager::User>& users, 48 void DOMLoginDisplay::Init(const std::vector<UserManager::User>& users,
40 bool show_guest, 49 bool show_guest,
41 bool show_new_user) { 50 bool show_new_user) {
42 // Testing that the delegate has been set. 51 // Testing that the delegate has been set.
43 DCHECK(delegate_); 52 DCHECK(delegate_);
44 users_ = users; 53 users_ = users;
45 54
46 // TODO(rharrison): Add mechanism to pass in the show_guest and show_new_user 55 // TODO(rharrison): Add mechanism to pass in the show_guest and show_new_user
47 // values. 56 // values.
48 login_screen_ = DOMBrowser::CreateForDOM(ProfileManager::GetDefaultProfile()); 57 webui_login_window_.reset(
49 login_screen_->AddSelectedTabWithURL(GURL(kLoginURL), 58 WebUILoginView::CreateWindowContainingView(background_bounds_,
50 PageTransition::START_PAGE); 59 GURL(kLoginURL),
51 login_screen_->window()->Show(); 60 &webui_login_view_));
61 webui_login_window_->Show();
52 } 62 }
53 63
54 void DOMLoginDisplay::OnBeforeUserRemoved(const std::string& username) { 64 void DOMLoginDisplay::OnBeforeUserRemoved(const std::string& username) {
55 // TODO(rharrison): Figure out if I need to split anything between this and 65 // TODO(rharrison): Figure out if I need to split anything between this and
56 // OnUserRemoved 66 // OnUserRemoved
57 } 67 }
58 68
59 void DOMLoginDisplay::OnUserImageChanged(UserManager::User* user) { 69 void DOMLoginDisplay::OnUserImageChanged(UserManager::User* user) {
60 // TODO(rharrison): Update the user in the user vector 70 // TODO(rharrison): Update the user in the user vector
61 // TODO(rharrison): Push the change to DOM Login screen 71 // TODO(rharrison): Push the change to DOM Login screen
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 delegate_->LoginAsGuest(); 107 delegate_->LoginAsGuest();
98 } 108 }
99 109
100 // DOMLoginDisplay, private: --------------------------------------------------- 110 // DOMLoginDisplay, private: ---------------------------------------------------
101 111
102 // Singleton implementation: --------------------------------------------------- 112 // Singleton implementation: ---------------------------------------------------
103 113
104 DOMLoginDisplay::DOMLoginDisplay() 114 DOMLoginDisplay::DOMLoginDisplay()
105 : LoginDisplay(NULL, gfx::Rect()), 115 : LoginDisplay(NULL, gfx::Rect()),
106 LoginUIHandlerDelegate(), 116 LoginUIHandlerDelegate(),
107 login_screen_(NULL) {} 117 webui_login_window_(NULL) {
118
119 }
120
108 121
109 } // namespace chromeos 122 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698