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/webui/signin/sync_confirmation_handler.cc

Issue 1814513002: Fix sizing issues in the tab modal signin flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address message handler related feedback 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 8 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
9 #include "chrome/browser/signin/account_tracker_service_factory.h" 9 #include "chrome/browser/signin/account_tracker_service_factory.h"
10 #include "chrome/browser/signin/signin_manager_factory.h" 10 #include "chrome/browser/signin/signin_manager_factory.h"
11 #include "chrome/browser/ui/browser_finder.h" 11 #include "chrome/browser/ui/browser_finder.h"
12 #include "chrome/browser/ui/browser_window.h" 12 #include "chrome/browser/ui/browser_window.h"
13 #include "chrome/browser/ui/signin_view_controller_delegate.h"
13 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 14 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
14 #include "components/signin/core/browser/account_tracker_service.h" 15 #include "components/signin/core/browser/account_tracker_service.h"
15 #include "content/public/browser/user_metrics.h" 16 #include "content/public/browser/user_metrics.h"
16 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
17 #include "content/public/browser/web_ui.h" 18 #include "content/public/browser/web_ui.h"
18 #include "url/gurl.h" 19 #include "url/gurl.h"
19 20
20 const int kProfileImageSize = 128; 21 const int kProfileImageSize = 128;
21 22
22 SyncConfirmationHandler::SyncConfirmationHandler() {} 23 SyncConfirmationHandler::SyncConfirmationHandler() {}
23 24
24 SyncConfirmationHandler::~SyncConfirmationHandler() { 25 SyncConfirmationHandler::~SyncConfirmationHandler() {
25 Profile* profile = Profile::FromWebUI(web_ui()); 26 Profile* profile = Profile::FromWebUI(web_ui());
26 AccountTrackerServiceFactory::GetForProfile(profile)->RemoveObserver(this); 27 AccountTrackerServiceFactory::GetForProfile(profile)->RemoveObserver(this);
27 } 28 }
28 29
29 void SyncConfirmationHandler::RegisterMessages() { 30 void SyncConfirmationHandler::RegisterMessages() {
30 web_ui()->RegisterMessageCallback("confirm", 31 web_ui()->RegisterMessageCallback("confirm",
31 base::Bind(&SyncConfirmationHandler::HandleConfirm, 32 base::Bind(&SyncConfirmationHandler::HandleConfirm,
32 base::Unretained(this))); 33 base::Unretained(this)));
33 web_ui()->RegisterMessageCallback("undo", 34 web_ui()->RegisterMessageCallback("undo",
34 base::Bind(&SyncConfirmationHandler::HandleUndo, base::Unretained(this))); 35 base::Bind(&SyncConfirmationHandler::HandleUndo, base::Unretained(this)));
35 web_ui()->RegisterMessageCallback("initialized", 36 web_ui()->RegisterMessageCallback("initialized",
36 base::Bind(&SyncConfirmationHandler::HandleInitialized, 37 base::Bind(&SyncConfirmationHandler::HandleInitialized,
37 base::Unretained(this))); 38 base::Unretained(this)));
38 web_ui()->RegisterMessageCallback("goToSettings", 39 web_ui()->RegisterMessageCallback("goToSettings",
39 base::Bind(&SyncConfirmationHandler::HandleGoToSettings, 40 base::Bind(&SyncConfirmationHandler::HandleGoToSettings,
40 base::Unretained(this))); 41 base::Unretained(this)));
42 web_ui()->RegisterMessageCallback("resizeNativeView",
43 base::Bind(&SyncConfirmationHandler::HandleResizeNativeView,
44 base::Unretained(this)));
41 } 45 }
42 46
43 void SyncConfirmationHandler::HandleConfirm(const base::ListValue* args) { 47 void SyncConfirmationHandler::HandleConfirm(const base::ListValue* args) {
44 CloseModalSigninWindow(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS); 48 CloseModalSigninWindow(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS);
45 } 49 }
46 50
47 void SyncConfirmationHandler::HandleGoToSettings(const base::ListValue* args) { 51 void SyncConfirmationHandler::HandleGoToSettings(const base::ListValue* args) {
48 CloseModalSigninWindow(LoginUIService::CONFIGURE_SYNC_FIRST); 52 CloseModalSigninWindow(LoginUIService::CONFIGURE_SYNC_FIRST);
49 } 53 }
50 54
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return browser; 108 return browser;
105 } 109 }
106 110
107 void SyncConfirmationHandler::CloseModalSigninWindow( 111 void SyncConfirmationHandler::CloseModalSigninWindow(
108 LoginUIService::SyncConfirmationUIClosedResults results) { 112 LoginUIService::SyncConfirmationUIClosedResults results) {
109 Browser* browser = GetDesktopBrowser(); 113 Browser* browser = GetDesktopBrowser();
110 LoginUIServiceFactory::GetForProfile(browser->profile())-> 114 LoginUIServiceFactory::GetForProfile(browser->profile())->
111 SyncConfirmationUIClosed(results); 115 SyncConfirmationUIClosed(results);
112 browser->CloseModalSigninWindow(); 116 browser->CloseModalSigninWindow();
113 } 117 }
118
119 void SyncConfirmationHandler::HandleResizeNativeView(
120 const base::ListValue* args) {
121 double height;
122 bool success = args->GetDouble(0, &height);
123 DCHECK(success);
124
125 Browser* browser = GetDesktopBrowser();
126 DCHECK(browser);
127
128 browser->signin_view_controller()->delegate()->ResizeNativeView(
129 static_cast<int>(height));
130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698