| OLD | NEW |
| 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_list.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 void LoginUIService::LoginUIClosed(content::WebUI* ui) { | 29 void LoginUIService::LoginUIClosed(content::WebUI* ui) { |
| 30 if (current_login_ui() == ui) | 30 if (current_login_ui() == ui) |
| 31 ui_ = NULL; | 31 ui_ = NULL; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void LoginUIService::FocusLoginUI() { | 34 void LoginUIService::FocusLoginUI() { |
| 35 if (!ui_) { | 35 if (!ui_) { |
| 36 NOTREACHED() << "FocusLoginUI() called with no active login UI"; | 36 NOTREACHED() << "FocusLoginUI() called with no active login UI"; |
| 37 return; | 37 return; |
| 38 } | 38 } |
| 39 ui_->GetWebContents()->GetRenderViewHost()->delegate()->Activate(); | 39 ui_->GetWebContents()->GetRenderViewHost()->GetDelegate()->Activate(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void LoginUIService::ShowLoginUI() { | 42 void LoginUIService::ShowLoginUI() { |
| 43 if (ui_) { | 43 if (ui_) { |
| 44 // We already have active login UI - make it visible. | 44 // We already have active login UI - make it visible. |
| 45 FocusLoginUI(); | 45 FocusLoginUI(); |
| 46 return; | 46 return; |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Need to navigate to the settings page and display the UI. | 49 // Need to navigate to the settings page and display the UI. |
| 50 if (profile_) { | 50 if (profile_) { |
| 51 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); | 51 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); |
| 52 if (!browser) { | 52 if (!browser) { |
| 53 browser = Browser::Create(profile_); | 53 browser = Browser::Create(profile_); |
| 54 browser->ShowOptionsTab(chrome::kSyncSetupSubPage); | 54 browser->ShowOptionsTab(chrome::kSyncSetupSubPage); |
| 55 browser->window()->Show(); | 55 browser->window()->Show(); |
| 56 } else { | 56 } else { |
| 57 browser->ShowOptionsTab(chrome::kSyncSetupSubPage); | 57 browser->ShowOptionsTab(chrome::kSyncSetupSubPage); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 } | 60 } |
| OLD | NEW |