| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/welcome_handler.h" | 5 #include "chrome/browser/ui/webui/welcome_handler.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_factory.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // Handles backend events necessary when user clicks "Sign in." | 45 // Handles backend events necessary when user clicks "Sign in." |
| 46 void WelcomeHandler::HandleActivateSignIn(const base::ListValue* args) { | 46 void WelcomeHandler::HandleActivateSignIn(const base::ListValue* args) { |
| 47 if (SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()) { | 47 if (SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()) { |
| 48 // In general, this page isn't shown to signed-in users; however, if one | 48 // In general, this page isn't shown to signed-in users; however, if one |
| 49 // should arrive here, then opening the sign-in dialog will likely lead | 49 // should arrive here, then opening the sign-in dialog will likely lead |
| 50 // to a crash. Thus, we just act like sign-in was "successful" and whisk | 50 // to a crash. Thus, we just act like sign-in was "successful" and whisk |
| 51 // them away to the NTP instead. | 51 // them away to the NTP instead. |
| 52 GoToNewTabPage(); | 52 GoToNewTabPage(); |
| 53 } else { | 53 } else { |
| 54 GetBrowser()->ShowModalSigninWindow( | 54 Browser* browser = GetBrowser(); |
| 55 profiles::BubbleViewMode::BUBBLE_VIEW_MODE_GAIA_SIGNIN, | 55 browser->signin_view_controller()->ShowModalSignin( |
| 56 profiles::BubbleViewMode::BUBBLE_VIEW_MODE_GAIA_SIGNIN, browser, |
| 56 signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE); | 57 signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE); |
| 57 } | 58 } |
| 58 } | 59 } |
| 59 | 60 |
| 60 // Handles backend events necessary when user clicks "No thanks." | 61 // Handles backend events necessary when user clicks "No thanks." |
| 61 void WelcomeHandler::HandleUserDecline(const base::ListValue* args) { | 62 void WelcomeHandler::HandleUserDecline(const base::ListValue* args) { |
| 62 result_ = WelcomeResult::DECLINED; | 63 result_ = WelcomeResult::DECLINED; |
| 63 GoToNewTabPage(); | 64 GoToNewTabPage(); |
| 64 } | 65 } |
| 65 | 66 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 80 } | 81 } |
| 81 | 82 |
| 82 Browser* WelcomeHandler::GetBrowser() { | 83 Browser* WelcomeHandler::GetBrowser() { |
| 83 DCHECK(web_ui()); | 84 DCHECK(web_ui()); |
| 84 content::WebContents* contents = web_ui()->GetWebContents(); | 85 content::WebContents* contents = web_ui()->GetWebContents(); |
| 85 DCHECK(contents); | 86 DCHECK(contents); |
| 86 Browser* browser = chrome::FindBrowserWithWebContents(contents); | 87 Browser* browser = chrome::FindBrowserWithWebContents(contents); |
| 87 DCHECK(browser); | 88 DCHECK(browser); |
| 88 return browser; | 89 return browser; |
| 89 } | 90 } |
| OLD | NEW |