OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_list/chrome_signin_delegate.h" | 5 #include "chrome/browser/ui/app_list/chrome_signin_delegate.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/signin/signin_manager.h" | 9 #include "chrome/browser/signin/signin_manager.h" |
10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_factory.h" |
11 #include "chrome/browser/signin/signin_promo.h" | 11 #include "chrome/browser/signin/signin_promo.h" |
12 #include "chrome/browser/ui/browser_finder.h" | 12 #include "chrome/browser/ui/browser_finder.h" |
13 #include "chrome/browser/ui/browser_navigator.h" | 13 #include "chrome/browser/ui/browser_navigator.h" |
14 #include "chrome/browser/ui/chrome_pages.h" | 14 #include "chrome/browser/ui/chrome_pages.h" |
15 #include "chrome/browser/ui/extensions/application_launch.h" | 15 #include "chrome/browser/ui/extensions/application_launch.h" |
16 #include "chrome/browser/ui/host_desktop.h" | 16 #include "chrome/browser/ui/host_desktop.h" |
17 #include "chrome/common/extensions/extension_constants.h" | 17 #include "chrome/common/extensions/extension_constants.h" |
18 #include "content/public/common/page_transition_types.h" | 18 #include "content/public/common/page_transition_types.h" |
19 #include "grit/chromium_strings.h" | 19 #include "grit/chromium_strings.h" |
20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
21 #include "ui/app_list/signin_delegate_observer.h" | |
22 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
23 | 22 |
24 namespace { | 23 namespace { |
25 | 24 |
26 SigninManagerBase* GetSigninManager(Profile* profile) { | 25 SigninManagerBase* GetSigninManager(Profile* profile) { |
27 return SigninManagerFactory::GetForProfile(profile); | 26 return SigninManagerFactory::GetForProfile(profile); |
28 } | 27 } |
29 | 28 |
30 } // namespace | 29 } // namespace |
31 | 30 |
(...skipping 10 matching lines...) Expand all Loading... |
42 if (!GetSigninManager(profile_)) | 41 if (!GetSigninManager(profile_)) |
43 return false; | 42 return false; |
44 | 43 |
45 return GetSigninManager(profile_)->GetAuthenticatedUsername().empty(); | 44 return GetSigninManager(profile_)->GetAuthenticatedUsername().empty(); |
46 #endif | 45 #endif |
47 } | 46 } |
48 | 47 |
49 void ChromeSigninDelegate::ShowSignin() { | 48 void ChromeSigninDelegate::ShowSignin() { |
50 DCHECK(profile_); | 49 DCHECK(profile_); |
51 | 50 |
52 signin_tracker_.reset(new SigninTracker(profile_, this)); | |
53 | |
54 Browser* browser = FindOrCreateTabbedBrowser(profile_, | 51 Browser* browser = FindOrCreateTabbedBrowser(profile_, |
55 chrome::GetActiveDesktop()); | 52 chrome::GetActiveDesktop()); |
56 chrome::ShowBrowserSignin(browser, signin::SOURCE_APP_LAUNCHER); | 53 chrome::ShowBrowserSignin(browser, signin::SOURCE_APP_LAUNCHER); |
57 } | 54 } |
58 | 55 |
59 void ChromeSigninDelegate::OpenLearnMore() { | 56 void ChromeSigninDelegate::OpenLearnMore() { |
60 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 57 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
61 GURL gurl(rb.GetLocalizedString(IDS_APP_LIST_SIGNIN_LEARN_MORE_LINK)); | 58 GURL gurl(rb.GetLocalizedString(IDS_APP_LIST_SIGNIN_LEARN_MORE_LINK)); |
62 chrome::NavigateParams params(profile_, gurl, content::PAGE_TRANSITION_LINK); | 59 chrome::NavigateParams params(profile_, gurl, content::PAGE_TRANSITION_LINK); |
63 chrome::Navigate(¶ms); | 60 chrome::Navigate(¶ms); |
(...skipping 30 matching lines...) Expand all Loading... |
94 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 91 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
95 return rb.GetLocalizedString(IDS_APP_LIST_SIGNIN_LEARN_MORE_TEXT); | 92 return rb.GetLocalizedString(IDS_APP_LIST_SIGNIN_LEARN_MORE_TEXT); |
96 } | 93 } |
97 | 94 |
98 string16 ChromeSigninDelegate::GetSettingsLinkText() { | 95 string16 ChromeSigninDelegate::GetSettingsLinkText() { |
99 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 96 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
100 return rb.GetLocalizedString(IDS_APP_LIST_SIGNIN_SETTINGS_TEXT); | 97 return rb.GetLocalizedString(IDS_APP_LIST_SIGNIN_SETTINGS_TEXT); |
101 } | 98 } |
102 | 99 |
103 ChromeSigninDelegate::~ChromeSigninDelegate() {} | 100 ChromeSigninDelegate::~ChromeSigninDelegate() {} |
104 | |
105 void ChromeSigninDelegate::SigninFailed(const GoogleServiceAuthError& error) {} | |
106 | |
107 void ChromeSigninDelegate::SigninSuccess() { | |
108 NotifySigninSuccess(); | |
109 } | |
OLD | NEW |