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

Side by Side Diff: chrome/browser/ui/webui/signin/login_ui_service.cc

Issue 10699013: Add a method to LoginUIService to open the sign in UI in a popup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/webui/signin/login_ui_service.h" 5 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/chrome_pages.h" 8 #include "chrome/browser/ui/chrome_pages.h"
9 #include "chrome/common/url_constants.h" 9 #include "chrome/common/url_constants.h"
10 10
11 LoginUIService::LoginUIService() : ui_(NULL) { 11 LoginUIService::LoginUIService() : ui_(NULL) {
12 } 12 }
13 13
14 LoginUIService::~LoginUIService() {} 14 LoginUIService::~LoginUIService() {}
15 15
16 void LoginUIService::AddObserver(LoginUIService::Observer* observer) {
17 observer_list_.AddObserver(observer);
18 }
19
20 void LoginUIService::RemoveObserver(LoginUIService::Observer* observer) {
21 observer_list_.RemoveObserver(observer);
22 }
23
16 void LoginUIService::SetLoginUI(LoginUI* ui) { 24 void LoginUIService::SetLoginUI(LoginUI* ui) {
17 DCHECK(!current_login_ui() || current_login_ui() == ui); 25 DCHECK(!current_login_ui() || current_login_ui() == ui);
18 ui_ = ui; 26 ui_ = ui;
27 FOR_EACH_OBSERVER(Observer, observer_list_, OnLoginUIShown(ui_));
19 } 28 }
20 29
21 void LoginUIService::LoginUIClosed(LoginUI* ui) { 30 void LoginUIService::LoginUIClosed(LoginUI* ui) {
22 if (current_login_ui() == ui) 31 if (current_login_ui() != ui)
23 ui_ = NULL; 32 return;
33
34 ui_ = NULL;
35 FOR_EACH_OBSERVER(Observer, observer_list_, OnLoginUIClosed(ui));
24 } 36 }
25 37
26 void LoginUIService::ShowLoginUI(Browser* browser) { 38 void LoginUIService::ShowLoginUI(Browser* browser) {
27 if (ui_) { 39 if (ui_) {
28 // We already have active login UI - make it visible. 40 // We already have active login UI - make it visible.
29 ui_->FocusUI(); 41 ui_->FocusUI();
30 return; 42 return;
31 } 43 }
32 44
33 // Need to navigate to the settings page and display the UI. 45 // Need to navigate to the settings page and display the UI.
34 chrome::ShowSettingsSubPage(browser, chrome::kSyncSetupSubPage); 46 chrome::ShowSettingsSubPage(browser, chrome::kSyncSetupSubPage);
35 } 47 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/login_ui_service.h ('k') | chrome/browser/ui/webui/signin/login_ui_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698