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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_sync_starter.cc

Issue 1511023002: Do not reuse webcontent which associates constrained login page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | 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/sync/one_click_signin_sync_starter.h" 5 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 22 matching lines...) Expand all
33 #include "chrome/browser/ui/tab_dialogs.h" 33 #include "chrome/browser/ui/tab_dialogs.h"
34 #include "chrome/browser/ui/tabs/tab_strip_model.h" 34 #include "chrome/browser/ui/tabs/tab_strip_model.h"
35 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 35 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
36 #include "chrome/common/url_constants.h" 36 #include "chrome/common/url_constants.h"
37 #include "chrome/grit/chromium_strings.h" 37 #include "chrome/grit/chromium_strings.h"
38 #include "chrome/grit/generated_resources.h" 38 #include "chrome/grit/generated_resources.h"
39 #include "components/browser_sync/browser/profile_sync_service.h" 39 #include "components/browser_sync/browser/profile_sync_service.h"
40 #include "components/signin/core/browser/signin_manager.h" 40 #include "components/signin/core/browser/signin_manager.h"
41 #include "components/signin/core/browser/signin_metrics.h" 41 #include "components/signin/core/browser/signin_metrics.h"
42 #include "components/sync_driver/sync_prefs.h" 42 #include "components/sync_driver/sync_prefs.h"
43 #include "net/base/url_util.h"
43 #include "net/url_request/url_request_context_getter.h" 44 #include "net/url_request/url_request_context_getter.h"
44 #include "ui/base/l10n/l10n_util.h" 45 #include "ui/base/l10n/l10n_util.h"
45 46
46 namespace { 47 namespace {
47 48
48 // UMA histogram for tracking what users do when presented with the signin 49 // UMA histogram for tracking what users do when presented with the signin
49 // screen. 50 // screen.
50 // Hence, 51 // Hence,
51 // (a) existing enumerated constants should never be deleted or reordered, and 52 // (a) existing enumerated constants should never be deleted or reordered, and
52 // (b) new constants should only be appended at the end of the enumeration. 53 // (b) new constants should only be appended at the end of the enumeration.
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 login_ui->current_login_ui()->FocusUI(); 528 login_ui->current_login_ui()->FocusUI();
528 } else { 529 } else {
529 browser_ = EnsureBrowser(browser_, profile_, desktop_type_); 530 browser_ = EnsureBrowser(browser_, profile_, desktop_type_);
530 531
531 // If the sign in tab is showing the native signin page or the blank page 532 // If the sign in tab is showing the native signin page or the blank page
532 // for web-based flow, and is not about to be closed, use it to show the 533 // for web-based flow, and is not about to be closed, use it to show the
533 // settings UI. 534 // settings UI.
534 bool use_same_tab = false; 535 bool use_same_tab = false;
535 if (web_contents()) { 536 if (web_contents()) {
536 GURL current_url = web_contents()->GetLastCommittedURL(); 537 GURL current_url = web_contents()->GetLastCommittedURL();
538 std::string constrained_key;
539 net::GetValueForKeyInQuery(current_url, "constrained", &constrained_key);
540 bool is_constrained = (constrained_key == "1");
537 bool is_chrome_signin_url = 541 bool is_chrome_signin_url =
538 current_url.GetOrigin().spec() == chrome::kChromeUIChromeSigninURL; 542 current_url.GetOrigin().spec() == chrome::kChromeUIChromeSigninURL;
539 bool is_same_profile = 543 bool is_same_profile =
540 Profile::FromBrowserContext(web_contents()->GetBrowserContext()) == 544 Profile::FromBrowserContext(web_contents()->GetBrowserContext()) ==
541 profile_; 545 profile_;
542 use_same_tab = 546 use_same_tab = !is_constrained && is_chrome_signin_url &&
543 is_chrome_signin_url && 547 !signin::IsAutoCloseEnabledInURL(current_url) &&
544 !signin::IsAutoCloseEnabledInURL(current_url) && 548 is_same_profile;
545 is_same_profile;
546 } 549 }
547 if (profile_sync_service) { 550 if (profile_sync_service) {
548 // Need to navigate to the settings page and display the sync UI. 551 // Need to navigate to the settings page and display the sync UI.
549 if (use_same_tab) { 552 if (use_same_tab) {
550 ShowSettingsPageInWebContents(web_contents(), 553 ShowSettingsPageInWebContents(web_contents(),
551 chrome::kSyncSetupSubPage); 554 chrome::kSyncSetupSubPage);
552 } else { 555 } else {
553 // If the user is setting up sync for the first time, let them configure 556 // If the user is setting up sync for the first time, let them configure
554 // advanced sync settings. However, in the case of re-authentication, 557 // advanced sync settings. However, in the case of re-authentication,
555 // return the user to the settings page without showing any config UI. 558 // return the user to the settings page without showing any config UI.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 false /* user_gesture */); 616 false /* user_gesture */);
614 } 617 }
615 618
616 void OneClickSigninSyncStarter::LoadContinueUrl() { 619 void OneClickSigninSyncStarter::LoadContinueUrl() {
617 web_contents()->GetController().LoadURL( 620 web_contents()->GetController().LoadURL(
618 continue_url_, 621 continue_url_,
619 content::Referrer(), 622 content::Referrer(),
620 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 623 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
621 std::string()); 624 std::string());
622 } 625 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698