| 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/sync/one_click_signin_helper.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 break; | 102 break; |
| 103 default: | 103 default: |
| 104 NOTREACHED() << "Invalid auto_accept: " << auto_accept; | 104 NOTREACHED() << "Invalid auto_accept: " << auto_accept; |
| 105 break; | 105 break; |
| 106 } | 106 } |
| 107 | 107 |
| 108 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Reverse", action, | 108 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Reverse", action, |
| 109 one_click_signin::HISTOGRAM_MAX); | 109 one_click_signin::HISTOGRAM_MAX); |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool UseWebBasedSigninFlow() { | |
| 113 const bool use_web_based_singin_flow = | |
| 114 CommandLine::ForCurrentProcess()->HasSwitch( | |
| 115 switches::kUseWebBasedSigninFlow); | |
| 116 return use_web_based_singin_flow; | |
| 117 } | |
| 118 | |
| 119 // Determines the source of the sign in. Its either one of the known sign in | 112 // Determines the source of the sign in. Its either one of the known sign in |
| 120 // access point (first run, NTP, menu, settings) or its an implicit sign in | 113 // access point (first run, NTP, menu, settings) or its an implicit sign in |
| 121 // via another Google property. In the former case, "service" is also | 114 // via another Google property. In the former case, "service" is also |
| 122 // checked to make sure its "chromiumsync". | 115 // checked to make sure its "chromiumsync". |
| 123 SyncPromoUI::Source GetSigninSource(const GURL& url) { | 116 SyncPromoUI::Source GetSigninSource(const GURL& url) { |
| 124 std::string value; | 117 std::string value; |
| 125 chrome_common_net::GetValueForKeyInQuery(url, "service", &value); | 118 chrome_common_net::GetValueForKeyInQuery(url, "service", &value); |
| 126 bool is_explicit_signin = value == "chromiumsync"; | 119 bool is_explicit_signin = value == "chromiumsync"; |
| 127 | 120 |
| 128 chrome_common_net::GetValueForKeyInQuery(url, "continue", &value); | 121 chrome_common_net::GetValueForKeyInQuery(url, "continue", &value); |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 if (session_index.empty() && email.empty() && auto_accept == NO_AUTO_ACCEPT) | 650 if (session_index.empty() && email.empty() && auto_accept == NO_AUTO_ACCEPT) |
| 658 return; | 651 return; |
| 659 | 652 |
| 660 content::BrowserThread::PostTask( | 653 content::BrowserThread::PostTask( |
| 661 content::BrowserThread::UI, FROM_HERE, | 654 content::BrowserThread::UI, FROM_HERE, |
| 662 base::Bind(&OneClickSigninHelper::ShowInfoBarUIThread, session_index, | 655 base::Bind(&OneClickSigninHelper::ShowInfoBarUIThread, session_index, |
| 663 email, auto_accept, source, child_id, route_id)); | 656 email, auto_accept, source, child_id, route_id)); |
| 664 } | 657 } |
| 665 | 658 |
| 666 // static | 659 // static |
| 660 bool OneClickSigninHelper::UseWebBasedSigninFlow() { |
| 661 static const bool use_web_based_singin_flow = |
| 662 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 663 switches::kUseClientLoginSigninFlow); |
| 664 return use_web_based_singin_flow; |
| 665 } |
| 666 |
| 667 // static |
| 667 void OneClickSigninHelper::ShowInfoBarUIThread( | 668 void OneClickSigninHelper::ShowInfoBarUIThread( |
| 668 const std::string& session_index, | 669 const std::string& session_index, |
| 669 const std::string& email, | 670 const std::string& email, |
| 670 AutoAccept auto_accept, | 671 AutoAccept auto_accept, |
| 671 SyncPromoUI::Source source, | 672 SyncPromoUI::Source source, |
| 672 int child_id, | 673 int child_id, |
| 673 int route_id) { | 674 int route_id) { |
| 674 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 675 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 675 | 676 |
| 676 content::WebContents* web_contents = tab_util::GetWebContentsByID(child_id, | 677 content::WebContents* web_contents = tab_util::GetWebContentsByID(child_id, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 break; | 838 break; |
| 838 } | 839 } |
| 839 } | 840 } |
| 840 | 841 |
| 841 RedirectToNTP(); | 842 RedirectToNTP(); |
| 842 } | 843 } |
| 843 | 844 |
| 844 void OneClickSigninHelper::SigninSuccess() { | 845 void OneClickSigninHelper::SigninSuccess() { |
| 845 RedirectToNTP(); | 846 RedirectToNTP(); |
| 846 } | 847 } |
| OLD | NEW |