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

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

Issue 14846020: Add Views implementation of ProfileSigninConfirmationDialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more nits Created 7 years, 6 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
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/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 10
11 #if defined(ENABLE_CONFIGURATION_POLICY) 11 #if defined(ENABLE_CONFIGURATION_POLICY)
12 #include "chrome/browser/policy/cloud/user_policy_signin_service.h" 12 #include "chrome/browser/policy/cloud/user_policy_signin_service.h"
13 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" 13 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h"
14 #endif 14 #endif
15 15
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_info_cache.h" 17 #include "chrome/browser/profiles/profile_info_cache.h"
18 #include "chrome/browser/profiles/profile_io_data.h" 18 #include "chrome/browser/profiles/profile_io_data.h"
19 #include "chrome/browser/profiles/profile_manager.h" 19 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/signin/signin_manager.h" 20 #include "chrome/browser/signin/signin_manager.h"
21 #include "chrome/browser/signin/signin_manager_factory.h" 21 #include "chrome/browser/signin/signin_manager_factory.h"
22 #include "chrome/browser/sync/profile_sync_service.h" 22 #include "chrome/browser/sync/profile_sync_service.h"
23 #include "chrome/browser/sync/profile_sync_service_factory.h" 23 #include "chrome/browser/sync/profile_sync_service_factory.h"
24 #include "chrome/browser/sync/sync_prefs.h" 24 #include "chrome/browser/sync/sync_prefs.h"
25 #include "chrome/browser/ui/browser.h" 25 #include "chrome/browser/ui/browser.h"
26 #include "chrome/browser/ui/browser_dialogs.h"
26 #include "chrome/browser/ui/browser_finder.h" 27 #include "chrome/browser/ui/browser_finder.h"
27 #include "chrome/browser/ui/browser_navigator.h" 28 #include "chrome/browser/ui/browser_navigator.h"
28 #include "chrome/browser/ui/browser_window.h" 29 #include "chrome/browser/ui/browser_window.h"
29 #include "chrome/browser/ui/chrome_pages.h" 30 #include "chrome/browser/ui/chrome_pages.h"
31 #include "chrome/browser/ui/tabs/tab_strip_model.h"
30 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 32 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
31 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 33 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
32 #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h" 34 #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h"
33 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
34 #include "grit/chromium_strings.h" 36 #include "grit/chromium_strings.h"
35 #include "grit/generated_resources.h" 37 #include "grit/generated_resources.h"
36 #include "ui/base/l10n/l10n_util.h" 38 #include "ui/base/l10n/l10n_util.h"
37 #include "ui/base/resource/resource_bundle.h" 39 #include "ui/base/resource/resource_bundle.h"
38 40
39 OneClickSigninSyncStarter::OneClickSigninSyncStarter( 41 OneClickSigninSyncStarter::OneClickSigninSyncStarter(
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 135 }
134 136
135 DCHECK(client->is_registered()); 137 DCHECK(client->is_registered());
136 DVLOG(1) << "Policy registration succeeded: dm_token=" << client->dm_token(); 138 DVLOG(1) << "Policy registration succeeded: dm_token=" << client->dm_token();
137 139
138 // Stash away a copy of our CloudPolicyClient (should not already have one). 140 // Stash away a copy of our CloudPolicyClient (should not already have one).
139 DCHECK(!policy_client_); 141 DCHECK(!policy_client_);
140 policy_client_.swap(client); 142 policy_client_.swap(client);
141 143
142 // Allow user to create a new profile before continuing with sign-in. 144 // Allow user to create a new profile before continuing with sign-in.
143 ProfileSigninConfirmationDialog::ShowDialog( 145 Browser* browser =
146 chrome::FindBrowserWithProfile(profile_, chrome::GetActiveDesktop());
147 if (!browser) {
148 CancelSigninAndDelete();
149 return;
150 }
151 content::WebContents* web_contents =
152 browser->tab_strip_model()->GetActiveWebContents();
153 if (!web_contents) {
154 CancelSigninAndDelete();
155 return;
156 }
157 chrome::ShowProfileSigninConfirmationDialog(
158 browser,
159 web_contents,
144 profile_, 160 profile_,
145 signin->GetUsernameForAuthInProgress(), 161 signin->GetUsernameForAuthInProgress(),
146 base::Bind(&OneClickSigninSyncStarter::CancelSigninAndDelete, 162 base::Bind(&OneClickSigninSyncStarter::CancelSigninAndDelete,
147 weak_pointer_factory_.GetWeakPtr()), 163 weak_pointer_factory_.GetWeakPtr()),
148 base::Bind(&OneClickSigninSyncStarter::CreateNewSignedInProfile, 164 base::Bind(&OneClickSigninSyncStarter::CreateNewSignedInProfile,
149 weak_pointer_factory_.GetWeakPtr()), 165 weak_pointer_factory_.GetWeakPtr()),
150 base::Bind(&OneClickSigninSyncStarter::LoadPolicyWithCachedClient, 166 base::Bind(&OneClickSigninSyncStarter::LoadPolicyWithCachedClient,
151 weak_pointer_factory_.GetWeakPtr())); 167 weak_pointer_factory_.GetWeakPtr()));
152 } 168 }
153 169
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 411
396 void OneClickSigninSyncStarter::ShowSyncSettingsPageOnSameTab() { 412 void OneClickSigninSyncStarter::ShowSyncSettingsPageOnSameTab() {
397 std::string url = std::string(chrome::kChromeUISettingsURL) + 413 std::string url = std::string(chrome::kChromeUISettingsURL) +
398 chrome::kSyncSetupSubPage; 414 chrome::kSyncSetupSubPage;
399 chrome::NavigateParams params( 415 chrome::NavigateParams params(
400 browser_, GURL(url), content::PAGE_TRANSITION_AUTO_TOPLEVEL); 416 browser_, GURL(url), content::PAGE_TRANSITION_AUTO_TOPLEVEL);
401 params.disposition = CURRENT_TAB; 417 params.disposition = CURRENT_TAB;
402 params.window_action = chrome::NavigateParams::SHOW_WINDOW; 418 params.window_action = chrome::NavigateParams::SHOW_WINDOW;
403 chrome::Navigate(&params); 419 chrome::Navigate(&params);
404 } 420 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_dialogs.h ('k') | chrome/browser/ui/sync/profile_signin_confirmation_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698