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

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

Issue 10391158: Moves methods for finding browsers to browser_finder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include fixs Created 8 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) 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/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_list.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
12 12
13 LoginUIService::LoginUIService(Profile* profile) 13 LoginUIService::LoginUIService(Profile* profile)
14 : ui_(NULL), 14 : ui_(NULL),
15 profile_(profile) { 15 profile_(profile) {
16 } 16 }
17 17
18 LoginUIService::~LoginUIService() {} 18 LoginUIService::~LoginUIService() {}
19 19
20 void LoginUIService::SetLoginUI(LoginUI* ui) { 20 void LoginUIService::SetLoginUI(LoginUI* ui) {
21 DCHECK(!current_login_ui() || current_login_ui() == ui); 21 DCHECK(!current_login_ui() || current_login_ui() == ui);
22 ui_ = ui; 22 ui_ = ui;
23 } 23 }
24 24
25 void LoginUIService::LoginUIClosed(LoginUI* ui) { 25 void LoginUIService::LoginUIClosed(LoginUI* ui) {
26 if (current_login_ui() == ui) 26 if (current_login_ui() == ui)
27 ui_ = NULL; 27 ui_ = NULL;
28 } 28 }
29 29
30 void LoginUIService::ShowLoginUI() { 30 void LoginUIService::ShowLoginUI() {
31 if (ui_) { 31 if (ui_) {
32 // We already have active login UI - make it visible. 32 // We already have active login UI - make it visible.
33 ui_->FocusUI(); 33 ui_->FocusUI();
34 return; 34 return;
35 } 35 }
36 36
37 // Need to navigate to the settings page and display the UI. 37 // Need to navigate to the settings page and display the UI.
38 if (profile_) { 38 if (profile_) {
39 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); 39 Browser* browser = browser::FindLastActiveWithProfile(profile_);
40 if (!browser) { 40 if (!browser) {
41 browser = Browser::Create(profile_); 41 browser = Browser::Create(profile_);
42 browser->ShowOptionsTab(chrome::kSyncSetupSubPage); 42 browser->ShowOptionsTab(chrome::kSyncSetupSubPage);
43 browser->window()->Show(); 43 browser->window()->Show();
44 } else { 44 } else {
45 browser->ShowOptionsTab(chrome::kSyncSetupSubPage); 45 browser->ShowOptionsTab(chrome::kSyncSetupSubPage);
46 } 46 }
47 } 47 }
48 } 48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698