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

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

Issue 131973004: Eliminate usage of PO2TS::GetPrimaryAccountID() in UbertokenFetcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile failure 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/signin/ubertoken_fetcher_unittest.cc ('k') | no next file » | 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"
20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
19 #include "chrome/browser/signin/ubertoken_fetcher.h" 21 #include "chrome/browser/signin/ubertoken_fetcher.h"
20 #include "chrome/browser/ui/sync/sync_promo_ui.h" 22 #include "chrome/browser/ui/sync/sync_promo_ui.h"
21 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
23 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
24 #include "content/public/browser/navigation_controller.h" 26 #include "content/public/browser/navigation_controller.h"
25 #include "content/public/browser/notification_details.h" 27 #include "content/public/browser/notification_details.h"
26 #include "content/public/browser/notification_observer.h" 28 #include "content/public/browser/notification_observer.h"
27 #include "content/public/browser/notification_registrar.h" 29 #include "content/public/browser/notification_registrar.h"
28 #include "content/public/browser/notification_source.h" 30 #include "content/public/browser/notification_source.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 scoped_ptr<UbertokenFetcher> ubertoken_fetcher_; 79 scoped_ptr<UbertokenFetcher> ubertoken_fetcher_;
78 80
79 DISALLOW_COPY_AND_ASSIGN(AutoLoginRedirector); 81 DISALLOW_COPY_AND_ASSIGN(AutoLoginRedirector);
80 }; 82 };
81 83
82 AutoLoginRedirector::AutoLoginRedirector( 84 AutoLoginRedirector::AutoLoginRedirector(
83 content::WebContents* web_contents, 85 content::WebContents* web_contents,
84 const std::string& args) 86 const std::string& args)
85 : content::WebContentsObserver(web_contents), 87 : content::WebContentsObserver(web_contents),
86 args_(args) { 88 args_(args) {
87 ubertoken_fetcher_.reset(new UbertokenFetcher( 89 Profile* profile =
88 Profile::FromBrowserContext(web_contents->GetBrowserContext()), this)); 90 Profile::FromBrowserContext(web_contents->GetBrowserContext());
89 ubertoken_fetcher_->StartFetchingToken(); 91 ProfileOAuth2TokenService* token_service =
92 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
93 ubertoken_fetcher_.reset(new UbertokenFetcher(profile, this));
94 ubertoken_fetcher_->StartFetchingToken(token_service->GetPrimaryAccountId());
90 } 95 }
91 96
92 AutoLoginRedirector::~AutoLoginRedirector() { 97 AutoLoginRedirector::~AutoLoginRedirector() {
93 } 98 }
94 99
95 void AutoLoginRedirector::WebContentsDestroyed( 100 void AutoLoginRedirector::WebContentsDestroyed(
96 content::WebContents* web_contents) { 101 content::WebContents* web_contents) {
97 // The WebContents that started this has been destroyed. The request must be 102 // The WebContents that started this has been destroyed. The request must be
98 // cancelled and this object must be deleted. 103 // cancelled and this object must be deleted.
99 ubertoken_fetcher_.reset(); 104 ubertoken_fetcher_.reset();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 const content::NotificationSource& source, 217 const content::NotificationSource& source,
213 const content::NotificationDetails& details) { 218 const content::NotificationDetails& details) {
214 DCHECK_EQ(chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, type); 219 DCHECK_EQ(chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, type);
215 infobar()->RemoveSelf(); 220 infobar()->RemoveSelf();
216 } 221 }
217 222
218 void AutoLoginInfoBarDelegate::RecordHistogramAction(Actions action) { 223 void AutoLoginInfoBarDelegate::RecordHistogramAction(Actions action) {
219 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Regular", action, 224 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Regular", action,
220 HISTOGRAM_BOUNDING_VALUE); 225 HISTOGRAM_BOUNDING_VALUE);
221 } 226 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/ubertoken_fetcher_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698