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

Side by Side Diff: chrome/browser/ui/signin_view_controller_delegate.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: Rebase Created 4 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/signin_view_controller_delegate.h" 5 #include "chrome/browser/ui/signin_view_controller_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/values.h"
8 #include "chrome/browser/ui/signin_view_controller.h" 9 #include "chrome/browser/ui/signin_view_controller.h"
9 #include "chrome/browser/ui/webui/signin/get_auth_frame.h" 10 #include "chrome/browser/ui/webui/signin/get_auth_frame.h"
10 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
11 12
12 namespace { 13 namespace {
13 14
14 content::WebContents* GetAuthFrameWebContents( 15 content::WebContents* GetAuthFrameWebContents(
15 content::WebContents* web_ui_web_contents) { 16 content::WebContents* web_ui_web_contents) {
16 return signin::GetAuthFrameWebContents(web_ui_web_contents, "signin-frame"); 17 return signin::GetAuthFrameWebContents(web_ui_web_contents, "signin-frame");
17 } 18 }
18 19
19 } // namespace 20 } // namespace
20 21
21 SigninViewControllerDelegate::SigninViewControllerDelegate( 22 SigninViewControllerDelegate::SigninViewControllerDelegate(
22 SigninViewController* signin_view_controller, 23 SigninViewController* signin_view_controller,
23 content::WebContents* web_contents) 24 content::WebContents* web_contents)
24 : signin_view_controller_(signin_view_controller), 25 : signin_view_controller_(signin_view_controller),
25 web_contents_(web_contents) { 26 web_contents_(web_contents) {
26 web_contents_->SetDelegate(this); 27 web_contents_->SetDelegate(this);
27 web_contents_->GetWebUI()->RegisterMessageCallback( 28 web_contents_->GetWebUI()->RegisterMessageCallback(
Dan Beam 2016/03/18 18:10:08 hmmm, this is kind of weird. I wonder why Registe
anthonyvd 2016/03/18 18:53:40 Is there a canonical way to get this information f
Dan Beam 2016/03/18 21:07:47 overall: I think it's just more common to handle m
anthonyvd 2016/04/04 14:15:56 Thanks for the detailed input. I wasn't too sure w
28 "navigationButtonClicked", 29 "navigationButtonClicked",
29 base::Bind(&SigninViewControllerDelegate::HandleNavigationButtonClicked, 30 base::Bind(&SigninViewControllerDelegate::HandleNavigationButtonClicked,
30 base::Unretained(this))); 31 base::Unretained(this)));
32 web_contents_->GetWebUI()->RegisterMessageCallback(
33 "resizeNativeView",
34 base::Bind(&SigninViewControllerDelegate::HandleResizeNativeView,
35 base::Unretained(this)));
31 } 36 }
32 37
33 SigninViewControllerDelegate::~SigninViewControllerDelegate() {} 38 SigninViewControllerDelegate::~SigninViewControllerDelegate() {}
34 39
35 void SigninViewControllerDelegate::CloseModalSignin() { 40 void SigninViewControllerDelegate::CloseModalSignin() {
36 ResetSigninViewControllerDelegate(); 41 ResetSigninViewControllerDelegate();
37 PerformClose(); 42 PerformClose();
38 } 43 }
39 44
40 void SigninViewControllerDelegate::ResetSigninViewControllerDelegate() { 45 void SigninViewControllerDelegate::ResetSigninViewControllerDelegate() {
(...skipping 21 matching lines...) Expand all
62 67
63 void SigninViewControllerDelegate::HandleNavigationButtonClicked( 68 void SigninViewControllerDelegate::HandleNavigationButtonClicked(
64 const base::ListValue* args) { 69 const base::ListValue* args) {
65 if (CanGoBack(web_contents_)) { 70 if (CanGoBack(web_contents_)) {
66 auto auth_web_contents = GetAuthFrameWebContents(web_contents_); 71 auto auth_web_contents = GetAuthFrameWebContents(web_contents_);
67 auth_web_contents->GetController().GoBack(); 72 auth_web_contents->GetController().GoBack();
68 } else { 73 } else {
69 CloseModalSignin(); 74 CloseModalSignin();
70 } 75 }
71 } 76 }
77
78 void SigninViewControllerDelegate::HandleResizeNativeView(
79 const base::ListValue* args) {
80 int height;
81 if (args->GetInteger(0, &height)) {
Dan Beam 2016/03/18 18:10:08 double height; CHECK(args->GetInteger(0, &height))
anthonyvd 2016/03/18 18:53:40 Done.
82 ResizeNativeView(height);
83 }
84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698