Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CHROME_BROWSER_UI_SIGNIN_VIEW_CONTROLLER_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_SIGNIN_VIEW_CONTROLLER_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_SIGNIN_VIEW_CONTROLLER_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_SIGNIN_VIEW_CONTROLLER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/ui/profile_chooser_constants.h" | 8 #include "chrome/browser/ui/profile_chooser_constants.h" |
| 9 #include "content/public/browser/web_contents_delegate.h" | 9 #include "content/public/browser/web_contents_delegate.h" |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 SigninViewController* signin_view_controller, | 39 SigninViewController* signin_view_controller, |
| 40 Browser* browser); | 40 Browser* browser); |
| 41 | 41 |
| 42 // Returns a platform-specific SigninViewControllerDelegate instance that | 42 // Returns a platform-specific SigninViewControllerDelegate instance that |
| 43 // displays the modal sign in error dialog. The returned object should delete | 43 // displays the modal sign in error dialog. The returned object should delete |
| 44 // itself when the window it's managing is closed. | 44 // itself when the window it's managing is closed. |
| 45 static SigninViewControllerDelegate* CreateSigninErrorDelegate( | 45 static SigninViewControllerDelegate* CreateSigninErrorDelegate( |
| 46 SigninViewController* signin_view_controller, | 46 SigninViewController* signin_view_controller, |
| 47 Browser* browser); | 47 Browser* browser); |
| 48 | 48 |
| 49 // Closes the modal sign-in dialog. | |
| 49 void CloseModalSignin(); | 50 void CloseModalSignin(); |
| 50 | 51 |
| 51 // Either navigates back in the signin flow if the history state allows it or | 52 // Either navigates back in the signin flow if the history state allows it or |
| 52 // closes the flow otherwise. | 53 // closes the flow otherwise. |
| 53 void PerformNavigation(); | 54 void PerformNavigation(); |
| 54 | 55 |
| 55 // This will be called by the base class to request a resize of the native | 56 // This will be called by the base class to request a resize of the native |
| 56 // view hosting the content to |height|. |height| is the total height of the | 57 // view hosting the content to |height|. |height| is the total height of the |
| 57 // content, in pixels. | 58 // content, in pixels. |
| 58 virtual void ResizeNativeView(int height) = 0; | 59 virtual void ResizeNativeView(int height) = 0; |
| 59 | 60 |
| 60 // content::WebContentsDelegate: | 61 // content::WebContentsDelegate: |
| 61 bool HandleContextMenu(const content::ContextMenuParams& params) override; | 62 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
| 62 | 63 |
| 63 // WebContents is used for executing javascript in the context of a modal sync | 64 // WebContents is used for executing javascript in the context of a modal sync |
| 64 // confirmation dialog. | 65 // confirmation dialog. |
| 65 content::WebContents* web_contents_for_testing() { return web_contents_; } | 66 content::WebContents* web_contents_for_testing() { return web_contents_; } |
| 66 | 67 |
| 67 protected: | 68 protected: |
| 69 // The presentation type of the modal sign-in dialog. | |
| 70 enum DialogModalType { | |
| 71 // The sign-in dialog is presented as tab modal: the user may interact with | |
| 72 // the parent window and the dialog is dismissed on tab navigation. | |
| 73 TAB_MODAL, | |
| 74 | |
| 75 // The sign-in dialog is presented as window modal: the user cannot interact | |
| 76 // with the parent window an | |
|
Peter Kasting
2017/01/11 01:24:45
Nit: Comment cut off
msarda
2017/01/11 09:54:25
Removed this enum.
| |
| 77 WINDOW_MODAL | |
| 78 }; | |
| 79 | |
| 68 SigninViewControllerDelegate(SigninViewController* signin_view_controller, | 80 SigninViewControllerDelegate(SigninViewController* signin_view_controller, |
| 69 content::WebContents* web_contents); | 81 content::WebContents* web_contents); |
| 70 ~SigninViewControllerDelegate() override; | 82 ~SigninViewControllerDelegate() override; |
| 71 | 83 |
| 72 // Notifies the SigninViewController that this instance is being deleted. | 84 // Notifies the SigninViewController that this instance is being deleted. |
| 73 void ResetSigninViewControllerDelegate(); | 85 void ResetSigninViewControllerDelegate(); |
| 74 | 86 |
| 75 // content::WebContentsDelegate | 87 // content::WebContentsDelegate |
| 76 void LoadingStateChanged(content::WebContents* source, | 88 void LoadingStateChanged(content::WebContents* source, |
| 77 bool to_different_document) override; | 89 bool to_different_document) override; |
| 78 | 90 |
| 79 // This will be called by this base class when the tab-modal window must be | 91 // This will be called by this base class when the tab-modal window must be |
| 80 // closed. This should close the platform-specific window that is currently | 92 // closed. This should close the platform-specific window that is currently |
| 81 // showing the sign in flow or the sync confirmation dialog. | 93 // showing the sign in flow or the sync confirmation dialog. |
| 82 virtual void PerformClose() = 0; | 94 virtual void PerformClose() = 0; |
| 83 | 95 |
| 84 private: | 96 private: |
| 85 bool CanGoBack(content::WebContents* web_ui_web_contents) const; | 97 bool CanGoBack(content::WebContents* web_ui_web_contents) const; |
| 86 | 98 |
| 87 SigninViewController* signin_view_controller_; // Not owned. | 99 SigninViewController* signin_view_controller_; // Not owned. |
| 88 content::WebContents* web_contents_; // Not owned. | 100 content::WebContents* web_contents_; // Not owned. |
| 89 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegate); | 101 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegate); |
| 90 }; | 102 }; |
| 91 | 103 |
| 92 #endif // CHROME_BROWSER_UI_SIGNIN_VIEW_CONTROLLER_DELEGATE_H_ | 104 #endif // CHROME_BROWSER_UI_SIGNIN_VIEW_CONTROLLER_DELEGATE_H_ |
| OLD | NEW |