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

Side by Side Diff: chrome/browser/ui/webui/signin/sync_confirmation_handler.cc

Issue 1868273002: Enhanced Sync Confirmation modal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dan's comments + rebase Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/webui/signin/sync_confirmation_handler.h" 5 #include "chrome/browser/ui/webui/signin/sync_confirmation_handler.h"
6 6
7 #include <vector>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 10 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
9 #include "chrome/browser/signin/account_tracker_service_factory.h" 11 #include "chrome/browser/signin/account_tracker_service_factory.h"
10 #include "chrome/browser/signin/signin_manager_factory.h" 12 #include "chrome/browser/signin/signin_manager_factory.h"
11 #include "chrome/browser/ui/browser_finder.h" 13 #include "chrome/browser/ui/browser_finder.h"
12 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
13 #include "chrome/browser/ui/signin_view_controller_delegate.h" 15 #include "chrome/browser/ui/signin_view_controller_delegate.h"
14 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 16 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
15 #include "components/signin/core/browser/account_tracker_service.h" 17 #include "components/signin/core/browser/account_tracker_service.h"
16 #include "content/public/browser/user_metrics.h" 18 #include "content/public/browser/user_metrics.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 Browser* SyncConfirmationHandler::GetDesktopBrowser() { 84 Browser* SyncConfirmationHandler::GetDesktopBrowser() {
83 Browser* browser = chrome::FindBrowserWithWebContents( 85 Browser* browser = chrome::FindBrowserWithWebContents(
84 web_ui()->GetWebContents()); 86 web_ui()->GetWebContents());
85 if (!browser) 87 if (!browser)
86 browser = chrome::FindLastActiveWithProfile(Profile::FromWebUI(web_ui())); 88 browser = chrome::FindLastActiveWithProfile(Profile::FromWebUI(web_ui()));
87 DCHECK(browser); 89 DCHECK(browser);
88 return browser; 90 return browser;
89 } 91 }
90 92
91 void SyncConfirmationHandler::CloseModalSigninWindow( 93 void SyncConfirmationHandler::CloseModalSigninWindow(
92 LoginUIService::SyncConfirmationUIClosedResults results) { 94 LoginUIService::SyncConfirmationUIClosedResult result) {
93 Browser* browser = GetDesktopBrowser(); 95 Browser* browser = GetDesktopBrowser();
94 LoginUIServiceFactory::GetForProfile(browser->profile())-> 96 LoginUIServiceFactory::GetForProfile(browser->profile())->
95 SyncConfirmationUIClosed(results); 97 SyncConfirmationUIClosed(result);
96 browser->CloseModalSigninWindow(); 98 browser->CloseModalSigninWindow();
97 } 99 }
98 100
99 void SyncConfirmationHandler::HandleInitializedWithSize( 101 void SyncConfirmationHandler::HandleInitializedWithSize(
100 const base::ListValue* args) { 102 const base::ListValue* args) {
101 Browser* browser = GetDesktopBrowser(); 103 Browser* browser = GetDesktopBrowser();
102 Profile* profile = browser->profile(); 104 Profile* profile = browser->profile();
103 std::vector<AccountInfo> accounts = 105 std::vector<AccountInfo> accounts =
104 AccountTrackerServiceFactory::GetForProfile(profile)->GetAccounts(); 106 AccountTrackerServiceFactory::GetForProfile(profile)->GetAccounts();
105 107
106 if (accounts.empty()) 108 if (accounts.empty())
107 return; 109 return;
108 110
109 AccountInfo primary_account_info = accounts[0]; 111 AccountInfo primary_account_info = accounts[0];
110 112
111 if (!primary_account_info.IsValid()) 113 if (!primary_account_info.IsValid())
112 AccountTrackerServiceFactory::GetForProfile(profile)->AddObserver(this); 114 AccountTrackerServiceFactory::GetForProfile(profile)->AddObserver(this);
113 else 115 else
114 SetUserImageURL(primary_account_info.picture_url); 116 SetUserImageURL(primary_account_info.picture_url);
115 117
116 double height; 118 double height;
117 bool success = args->GetDouble(0, &height); 119 bool success = args->GetDouble(0, &height);
118 DCHECK(success); 120 DCHECK(success);
119 121
120 browser->signin_view_controller()->delegate()->ResizeNativeView( 122 browser->signin_view_controller()->delegate()->ResizeNativeView(
121 static_cast<int>(height)); 123 static_cast<int>(height));
122 } 124 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/sync_confirmation_handler.h ('k') | chrome/browser/ui/webui/signin/sync_confirmation_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698