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

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: Fix unit tests 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 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 "navigationButtonClicked",
29 base::Bind(&SigninViewControllerDelegate::HandleNavigationButtonClicked,
30 base::Unretained(this)));
31 } 28 }
32 29
33 SigninViewControllerDelegate::~SigninViewControllerDelegate() {} 30 SigninViewControllerDelegate::~SigninViewControllerDelegate() {}
34 31
35 void SigninViewControllerDelegate::CloseModalSignin() { 32 void SigninViewControllerDelegate::CloseModalSignin() {
36 ResetSigninViewControllerDelegate(); 33 ResetSigninViewControllerDelegate();
37 PerformClose(); 34 PerformClose();
38 } 35 }
39 36
40 void SigninViewControllerDelegate::ResetSigninViewControllerDelegate() { 37 void SigninViewControllerDelegate::ResetSigninViewControllerDelegate() {
(...skipping 12 matching lines...) Expand all
53 // content::WebContentsDelegate 50 // content::WebContentsDelegate
54 void SigninViewControllerDelegate::LoadingStateChanged( 51 void SigninViewControllerDelegate::LoadingStateChanged(
55 content::WebContents* source, 52 content::WebContents* source,
56 bool to_different_document) { 53 bool to_different_document) {
57 if (CanGoBack(source)) 54 if (CanGoBack(source))
58 source->GetWebUI()->CallJavascriptFunction("inline.login.showBackButton"); 55 source->GetWebUI()->CallJavascriptFunction("inline.login.showBackButton");
59 else 56 else
60 source->GetWebUI()->CallJavascriptFunction("inline.login.showCloseButton"); 57 source->GetWebUI()->CallJavascriptFunction("inline.login.showCloseButton");
61 } 58 }
62 59
63 void SigninViewControllerDelegate::HandleNavigationButtonClicked( 60 void SigninViewControllerDelegate::PerformNavigation() {
64 const base::ListValue* args) {
65 if (CanGoBack(web_contents_)) { 61 if (CanGoBack(web_contents_)) {
66 auto auth_web_contents = GetAuthFrameWebContents(web_contents_); 62 auto auth_web_contents = GetAuthFrameWebContents(web_contents_);
67 auth_web_contents->GetController().GoBack(); 63 auth_web_contents->GetController().GoBack();
68 } else { 64 } else {
69 CloseModalSignin(); 65 CloseModalSignin();
70 } 66 }
71 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698