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

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

Issue 1336823003: Move chrome::HostDesktopType to ui::HostDesktopType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base_session_service_delegate_impl
Patch Set: Fix build on Mac and CrOS Created 5 years, 3 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/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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 const std::string& password, 78 const std::string& password,
79 const std::string& refresh_token, 79 const std::string& refresh_token,
80 StartSyncMode start_mode, 80 StartSyncMode start_mode,
81 content::WebContents* web_contents, 81 content::WebContents* web_contents,
82 ConfirmationRequired confirmation_required, 82 ConfirmationRequired confirmation_required,
83 const GURL& continue_url, 83 const GURL& continue_url,
84 Callback sync_setup_completed_callback) 84 Callback sync_setup_completed_callback)
85 : content::WebContentsObserver(web_contents), 85 : content::WebContentsObserver(web_contents),
86 profile_(NULL), 86 profile_(NULL),
87 start_mode_(start_mode), 87 start_mode_(start_mode),
88 desktop_type_(chrome::HOST_DESKTOP_TYPE_NATIVE), 88 desktop_type_(ui::HOST_DESKTOP_TYPE_NATIVE),
89 confirmation_required_(confirmation_required), 89 confirmation_required_(confirmation_required),
90 continue_url_(continue_url), 90 continue_url_(continue_url),
91 sync_setup_completed_callback_(sync_setup_completed_callback), 91 sync_setup_completed_callback_(sync_setup_completed_callback),
92 weak_pointer_factory_(this) { 92 weak_pointer_factory_(this) {
93 DCHECK(profile); 93 DCHECK(profile);
94 DCHECK(web_contents || continue_url.is_empty()); 94 DCHECK(web_contents || continue_url.is_empty());
95 BrowserList::AddObserver(this); 95 BrowserList::AddObserver(this);
96 Initialize(profile, browser); 96 Initialize(profile, browser);
97 97
98 // Policy is enabled, so pass in a callback to do extra policy-related UI 98 // Policy is enabled, so pass in a callback to do extra policy-related UI
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 GetProfileInfoCache().ChooseAvatarIconIndexForNewProfile(); 270 GetProfileInfoCache().ChooseAvatarIconIndexForNewProfile();
271 ProfileManager::CreateMultiProfileAsync( 271 ProfileManager::CreateMultiProfileAsync(
272 base::UTF8ToUTF16(signin->GetUsernameForAuthInProgress()), 272 base::UTF8ToUTF16(signin->GetUsernameForAuthInProgress()),
273 base::UTF8ToUTF16(profiles::GetDefaultAvatarIconUrl(icon_index)), 273 base::UTF8ToUTF16(profiles::GetDefaultAvatarIconUrl(icon_index)),
274 base::Bind(&OneClickSigninSyncStarter::CompleteInitForNewProfile, 274 base::Bind(&OneClickSigninSyncStarter::CompleteInitForNewProfile,
275 weak_pointer_factory_.GetWeakPtr(), desktop_type_), 275 weak_pointer_factory_.GetWeakPtr(), desktop_type_),
276 std::string()); 276 std::string());
277 } 277 }
278 278
279 void OneClickSigninSyncStarter::CompleteInitForNewProfile( 279 void OneClickSigninSyncStarter::CompleteInitForNewProfile(
280 chrome::HostDesktopType desktop_type, 280 ui::HostDesktopType desktop_type,
281 Profile* new_profile, 281 Profile* new_profile,
282 Profile::CreateStatus status) { 282 Profile::CreateStatus status) {
283 DCHECK_NE(profile_, new_profile); 283 DCHECK_NE(profile_, new_profile);
284 284
285 // TODO(atwilson): On error, unregister the client to release the DMToken 285 // TODO(atwilson): On error, unregister the client to release the DMToken
286 // and surface a better error for the user. 286 // and surface a better error for the user.
287 switch (status) { 287 switch (status) {
288 case Profile::CREATE_STATUS_LOCAL_FAIL: { 288 case Profile::CREATE_STATUS_LOCAL_FAIL: {
289 NOTREACHED() << "Error creating new profile"; 289 NOTREACHED() << "Error creating new profile";
290 CancelSigninAndDelete(); 290 CancelSigninAndDelete();
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 const base::string16& custom_message) { 486 const base::string16& custom_message) {
487 browser_ = EnsureBrowser(browser_, profile_, desktop_type_); 487 browser_ = EnsureBrowser(browser_, profile_, desktop_type_);
488 LoginUIServiceFactory::GetForProfile(browser_->profile())-> 488 LoginUIServiceFactory::GetForProfile(browser_->profile())->
489 DisplayLoginResult(browser_, custom_message); 489 DisplayLoginResult(browser_, custom_message);
490 } 490 }
491 491
492 // static 492 // static
493 Browser* OneClickSigninSyncStarter::EnsureBrowser( 493 Browser* OneClickSigninSyncStarter::EnsureBrowser(
494 Browser* browser, 494 Browser* browser,
495 Profile* profile, 495 Profile* profile,
496 chrome::HostDesktopType desktop_type) { 496 ui::HostDesktopType desktop_type) {
497 if (!browser) { 497 if (!browser) {
498 // The user just created a new profile or has closed the browser that 498 // The user just created a new profile or has closed the browser that
499 // we used previously. Grab the most recently active browser or else 499 // we used previously. Grab the most recently active browser or else
500 // create a new one. 500 // create a new one.
501 browser = chrome::FindLastActiveWithProfile(profile, desktop_type); 501 browser = chrome::FindLastActiveWithProfile(profile, desktop_type);
502 if (!browser) { 502 if (!browser) {
503 browser = new Browser(Browser::CreateParams(profile, 503 browser = new Browser(Browser::CreateParams(profile,
504 desktop_type)); 504 desktop_type));
505 chrome::AddTabAt(browser, GURL(), -1, true); 505 chrome::AddTabAt(browser, GURL(), -1, true);
506 } 506 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 false /* user_gesture */); 606 false /* user_gesture */);
607 } 607 }
608 608
609 void OneClickSigninSyncStarter::LoadContinueUrl() { 609 void OneClickSigninSyncStarter::LoadContinueUrl() {
610 web_contents()->GetController().LoadURL( 610 web_contents()->GetController().LoadURL(
611 continue_url_, 611 continue_url_,
612 content::Referrer(), 612 content::Referrer(),
613 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 613 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
614 std::string()); 614 std::string());
615 } 615 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698