Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: chrome/browser/ui/auto_login_infobar_delegate.cc

Issue 136723009: Move UbertokenFetcher from //chrome to //google_apis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/profile_sync_service_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/auto_login_infobar_delegate.h" 5 #include "chrome/browser/ui/auto_login_infobar_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/google/google_util.h" 15 #include "chrome/browser/google/google_util.h"
16 #include "chrome/browser/infobars/infobar.h" 16 #include "chrome/browser/infobars/infobar.h"
17 #include "chrome/browser/infobars/infobar_service.h" 17 #include "chrome/browser/infobars/infobar_service.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/signin/profile_oauth2_token_service.h" 19 #include "chrome/browser/signin/profile_oauth2_token_service.h"
20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
21 #include "chrome/browser/signin/ubertoken_fetcher.h"
22 #include "chrome/browser/ui/sync/sync_promo_ui.h" 21 #include "chrome/browser/ui/sync/sync_promo_ui.h"
23 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
25 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
26 #include "content/public/browser/navigation_controller.h" 25 #include "content/public/browser/navigation_controller.h"
27 #include "content/public/browser/notification_details.h" 26 #include "content/public/browser/notification_details.h"
28 #include "content/public/browser/notification_observer.h" 27 #include "content/public/browser/notification_observer.h"
29 #include "content/public/browser/notification_registrar.h" 28 #include "content/public/browser/notification_registrar.h"
30 #include "content/public/browser/notification_source.h" 29 #include "content/public/browser/notification_source.h"
31 #include "content/public/browser/notification_types.h" 30 #include "content/public/browser/notification_types.h"
32 #include "content/public/browser/page_navigator.h" 31 #include "content/public/browser/page_navigator.h"
33 #include "content/public/browser/web_contents.h" 32 #include "content/public/browser/web_contents.h"
34 #include "content/public/browser/web_contents_observer.h" 33 #include "content/public/browser/web_contents_observer.h"
35 #include "content/public/common/referrer.h" 34 #include "content/public/common/referrer.h"
36 #include "google_apis/gaia/gaia_constants.h" 35 #include "google_apis/gaia/gaia_constants.h"
37 #include "google_apis/gaia/gaia_urls.h" 36 #include "google_apis/gaia/gaia_urls.h"
37 #include "google_apis/gaia/ubertoken_fetcher.h"
38 #include "grit/chromium_strings.h" 38 #include "grit/chromium_strings.h"
39 #include "grit/generated_resources.h" 39 #include "grit/generated_resources.h"
40 #include "grit/theme_resources.h" 40 #include "grit/theme_resources.h"
41 #include "net/base/escape.h" 41 #include "net/base/escape.h"
42 #include "net/url_request/url_request.h" 42 #include "net/url_request/url_request.h"
43 #include "ui/base/l10n/l10n_util.h" 43 #include "ui/base/l10n/l10n_util.h"
44 44
45 #if defined(OS_ANDROID) 45 #if defined(OS_ANDROID)
46 #include "chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android .h" 46 #include "chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android .h"
47 #endif 47 #endif
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 AutoLoginRedirector::AutoLoginRedirector( 84 AutoLoginRedirector::AutoLoginRedirector(
85 content::WebContents* web_contents, 85 content::WebContents* web_contents,
86 const std::string& args) 86 const std::string& args)
87 : content::WebContentsObserver(web_contents), 87 : content::WebContentsObserver(web_contents),
88 args_(args) { 88 args_(args) {
89 Profile* profile = 89 Profile* profile =
90 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 90 Profile::FromBrowserContext(web_contents->GetBrowserContext());
91 ProfileOAuth2TokenService* token_service = 91 ProfileOAuth2TokenService* token_service =
92 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 92 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
93 ubertoken_fetcher_.reset(new UbertokenFetcher(profile, this)); 93 ubertoken_fetcher_.reset(new UbertokenFetcher(token_service,
94 this,
95 profile->GetRequestContext()));
94 ubertoken_fetcher_->StartFetchingToken(token_service->GetPrimaryAccountId()); 96 ubertoken_fetcher_->StartFetchingToken(token_service->GetPrimaryAccountId());
95 } 97 }
96 98
97 AutoLoginRedirector::~AutoLoginRedirector() { 99 AutoLoginRedirector::~AutoLoginRedirector() {
98 } 100 }
99 101
100 void AutoLoginRedirector::WebContentsDestroyed( 102 void AutoLoginRedirector::WebContentsDestroyed(
101 content::WebContents* web_contents) { 103 content::WebContents* web_contents) {
102 // The WebContents that started this has been destroyed. The request must be 104 // The WebContents that started this has been destroyed. The request must be
103 // cancelled and this object must be deleted. 105 // cancelled and this object must be deleted.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 const content::NotificationSource& source, 219 const content::NotificationSource& source,
218 const content::NotificationDetails& details) { 220 const content::NotificationDetails& details) {
219 DCHECK_EQ(chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, type); 221 DCHECK_EQ(chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, type);
220 infobar()->RemoveSelf(); 222 infobar()->RemoveSelf();
221 } 223 }
222 224
223 void AutoLoginInfoBarDelegate::RecordHistogramAction(Actions action) { 225 void AutoLoginInfoBarDelegate::RecordHistogramAction(Actions action) {
224 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Regular", action, 226 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Regular", action,
225 HISTOGRAM_BOUNDING_VALUE); 227 HISTOGRAM_BOUNDING_VALUE);
226 } 228 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698