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 14 matching lines...) Expand all Loading... |
25 #include "chrome/browser/signin/signin_manager.h" | 25 #include "chrome/browser/signin/signin_manager.h" |
26 #include "chrome/browser/signin/signin_manager_factory.h" | 26 #include "chrome/browser/signin/signin_manager_factory.h" |
27 #include "chrome/browser/signin/signin_names_io_thread.h" | 27 #include "chrome/browser/signin/signin_names_io_thread.h" |
28 #include "chrome/browser/sync/profile_sync_service.h" | 28 #include "chrome/browser/sync/profile_sync_service.h" |
29 #include "chrome/browser/sync/profile_sync_service_factory.h" | 29 #include "chrome/browser/sync/profile_sync_service_factory.h" |
30 #include "chrome/browser/tab_contents/tab_util.h" | 30 #include "chrome/browser/tab_contents/tab_util.h" |
31 #include "chrome/browser/ui/browser_finder.h" | 31 #include "chrome/browser/ui/browser_finder.h" |
32 #include "chrome/browser/ui/browser_window.h" | 32 #include "chrome/browser/ui/browser_window.h" |
33 #include "chrome/browser/ui/sync/one_click_signin_histogram.h" | 33 #include "chrome/browser/ui/sync/one_click_signin_histogram.h" |
34 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" | 34 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
35 #include "chrome/browser/ui/tab_contents/tab_contents.h" | |
36 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
37 #include "chrome/common/chrome_version_info.h" | 36 #include "chrome/common/chrome_version_info.h" |
38 #include "chrome/common/net/url_util.h" | 37 #include "chrome/common/net/url_util.h" |
39 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
40 #include "chrome/common/url_constants.h" | 39 #include "chrome/common/url_constants.h" |
41 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
42 #include "content/public/browser/page_navigator.h" | 41 #include "content/public/browser/page_navigator.h" |
43 #include "content/public/browser/web_contents.h" | 42 #include "content/public/browser/web_contents.h" |
44 #include "content/public/browser/web_contents_view.h" | 43 #include "content/public/browser/web_contents_view.h" |
45 #include "content/public/common/frame_navigate_params.h" | 44 #include "content/public/common/frame_navigate_params.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 alt_colors->button_text_color = SK_ColorWHITE; | 329 alt_colors->button_text_color = SK_ColorWHITE; |
331 alt_colors->button_background_color = SkColorSetRGB(71, 135, 237); | 330 alt_colors->button_background_color = SkColorSetRGB(71, 135, 237); |
332 alt_colors->button_border_color = SkColorSetRGB(48, 121, 237); | 331 alt_colors->button_border_color = SkColorSetRGB(48, 121, 237); |
333 return; | 332 return; |
334 } | 333 } |
335 | 334 |
336 return OneClickSigninInfoBarDelegate::GetAlternateColors(alt_colors); | 335 return OneClickSigninInfoBarDelegate::GetAlternateColors(alt_colors); |
337 } | 336 } |
338 | 337 |
339 void OneClickInfoBarDelegateImpl::DisableOneClickSignIn() { | 338 void OneClickInfoBarDelegateImpl::DisableOneClickSignIn() { |
340 PrefService* pref_service = | 339 Profile* profile = Profile::FromBrowserContext( |
341 TabContents::FromWebContents(owner()->GetWebContents())-> | 340 owner()->GetWebContents()->GetBrowserContext()); |
342 profile()->GetPrefs(); | 341 PrefService* pref_service = profile->GetPrefs(); |
343 pref_service->SetBoolean(prefs::kReverseAutologinEnabled, false); | 342 pref_service->SetBoolean(prefs::kReverseAutologinEnabled, false); |
344 } | 343 } |
345 | 344 |
346 void OneClickInfoBarDelegateImpl::AddEmailToOneClickRejectedList( | 345 void OneClickInfoBarDelegateImpl::AddEmailToOneClickRejectedList( |
347 const std::string& email) { | 346 const std::string& email) { |
348 PrefService* pref_service = | 347 Profile* profile = Profile::FromBrowserContext( |
349 TabContents::FromWebContents(owner()->GetWebContents())-> | 348 owner()->GetWebContents()->GetBrowserContext()); |
350 profile()->GetPrefs(); | 349 PrefService* pref_service = profile->GetPrefs(); |
351 ListPrefUpdate updater(pref_service, | 350 ListPrefUpdate updater(pref_service, |
352 prefs::kReverseAutologinRejectedEmailList); | 351 prefs::kReverseAutologinRejectedEmailList); |
353 updater->AppendIfNotPresent(new base::StringValue(email)); | 352 updater->AppendIfNotPresent(new base::StringValue(email)); |
354 } | 353 } |
355 | 354 |
356 void OneClickInfoBarDelegateImpl::RecordHistogramAction(int action) { | 355 void OneClickInfoBarDelegateImpl::RecordHistogramAction(int action) { |
357 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Reverse", action, | 356 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Reverse", action, |
358 one_click_signin::HISTOGRAM_MAX); | 357 one_click_signin::HISTOGRAM_MAX); |
359 } | 358 } |
360 | 359 |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 std::string()); | 777 std::string()); |
779 } | 778 } |
780 | 779 |
781 void OneClickSigninHelper::SigninFailed(const GoogleServiceAuthError& error) { | 780 void OneClickSigninHelper::SigninFailed(const GoogleServiceAuthError& error) { |
782 signin_tracker_.reset(); | 781 signin_tracker_.reset(); |
783 } | 782 } |
784 | 783 |
785 void OneClickSigninHelper::SigninSuccess() { | 784 void OneClickSigninHelper::SigninSuccess() { |
786 signin_tracker_.reset(); | 785 signin_tracker_.reset(); |
787 } | 786 } |
OLD | NEW |