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

Side by Side Diff: chrome/browser/net/gaia/gaia_oauth_fetcher.cc

Issue 8806011: Make NavigationEntry and friends use content::Referrer instead of plain URLs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years 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/external_tab_container_win.cc ('k') | chrome/browser/rlz/rlz_unittest.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/net/gaia/gaia_oauth_fetcher.h" 5 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 email->GetAsString(email_result); 275 email->GetAsString(email_result);
276 } 276 }
277 } 277 }
278 } 278 }
279 } 279 }
280 280
281 namespace { 281 namespace {
282 // Based on Browser::OpenURLFromTab 282 // Based on Browser::OpenURLFromTab
283 void OpenGetOAuthTokenURL(Browser* browser, 283 void OpenGetOAuthTokenURL(Browser* browser,
284 const GURL& url, 284 const GURL& url,
285 const GURL& referrer, 285 const content::Referrer& referrer,
286 WindowOpenDisposition disposition, 286 WindowOpenDisposition disposition,
287 content::PageTransition transition) { 287 content::PageTransition transition) {
288 browser::NavigateParams params( 288 browser::NavigateParams params(
289 browser, 289 browser,
290 url, 290 url,
291 content::PAGE_TRANSITION_AUTO_BOOKMARK); 291 content::PAGE_TRANSITION_AUTO_BOOKMARK);
292 params.source_contents = 292 params.source_contents =
293 browser->tabstrip_model()->GetTabContentsAt( 293 browser->tabstrip_model()->GetTabContentsAt(
294 browser->tabstrip_model()->GetWrapperIndex(NULL)); 294 browser->tabstrip_model()->GetWrapperIndex(NULL));
295 params.referrer = GURL("chrome://settings/personal"); 295 params.referrer = referrer;
296 params.disposition = disposition; 296 params.disposition = disposition;
297 params.tabstrip_add_types = TabStripModel::ADD_NONE; 297 params.tabstrip_add_types = TabStripModel::ADD_NONE;
298 params.window_action = browser::NavigateParams::SHOW_WINDOW; 298 params.window_action = browser::NavigateParams::SHOW_WINDOW;
299 params.window_bounds = gfx::Rect(380, 520); 299 params.window_bounds = gfx::Rect(380, 520);
300 params.user_gesture = true; 300 params.user_gesture = true;
301 browser::Navigate(&params); 301 browser::Navigate(&params);
302 } 302 }
303 } 303 }
304 304
305 void GaiaOAuthFetcher::StartGetOAuthToken() { 305 void GaiaOAuthFetcher::StartGetOAuthToken() {
306 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; 306 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!";
307 DCHECK(!popup_); 307 DCHECK(!popup_);
308 308
309 fetch_pending_ = true; 309 fetch_pending_ = true;
310 registrar_.Add(this, 310 registrar_.Add(this,
311 chrome::NOTIFICATION_COOKIE_CHANGED, 311 chrome::NOTIFICATION_COOKIE_CHANGED,
312 content::Source<Profile>(profile_)); 312 content::Source<Profile>(profile_));
313 313
314 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); 314 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
315 DCHECK(browser); 315 DCHECK(browser);
316 316
317 OpenGetOAuthTokenURL(browser, 317 OpenGetOAuthTokenURL(browser,
318 MakeGetOAuthTokenUrl(GaiaUrls::GetInstance()->oauth1_login_scope(), 318 MakeGetOAuthTokenUrl(GaiaUrls::GetInstance()->oauth1_login_scope(),
319 l10n_util::GetStringUTF8(IDS_PRODUCT_NAME)), 319 l10n_util::GetStringUTF8(IDS_PRODUCT_NAME)),
320 GURL("chrome://settings/personal"), 320 content::Referrer(GURL("chrome://settings/personal"),
321 WebKit::WebReferrerPolicyDefault),
321 NEW_POPUP, 322 NEW_POPUP,
322 content::PAGE_TRANSITION_AUTO_BOOKMARK); 323 content::PAGE_TRANSITION_AUTO_BOOKMARK);
323 popup_ = BrowserList::GetLastActiveWithProfile(profile_); 324 popup_ = BrowserList::GetLastActiveWithProfile(profile_);
324 DCHECK(popup_ && popup_ != browser); 325 DCHECK(popup_ && popup_ != browser);
325 registrar_.Add(this, 326 registrar_.Add(this,
326 chrome::NOTIFICATION_BROWSER_CLOSING, 327 chrome::NOTIFICATION_BROWSER_CLOSING,
327 content::Source<Browser>(popup_)); 328 content::Source<Browser>(popup_));
328 } 329 }
329 330
330 void GaiaOAuthFetcher::StartOAuthLogin( 331 void GaiaOAuthFetcher::StartOAuthLogin(
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 true)) { 686 true)) {
686 OnOAuthRevokeTokenFetched(data, status, response_code); 687 OnOAuthRevokeTokenFetched(data, status, response_code);
687 } else { 688 } else {
688 NOTREACHED(); 689 NOTREACHED();
689 } 690 }
690 } 691 }
691 692
692 bool GaiaOAuthFetcher::ShouldAutoFetch(AutoFetchLimit fetch_step) { 693 bool GaiaOAuthFetcher::ShouldAutoFetch(AutoFetchLimit fetch_step) {
693 return fetch_step <= auto_fetch_limit_; 694 return fetch_step <= auto_fetch_limit_;
694 } 695 }
OLDNEW
« no previous file with comments | « chrome/browser/external_tab_container_win.cc ('k') | chrome/browser/rlz/rlz_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698