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 Sign in dialog. The instance should be considered has being | |
| 50 // destroyed. | |
| 49 void CloseModalSignin(); | 51 void CloseModalSignin(); |
|
msarda
2017/01/10 15:58:43
There is a typo in this comment: "the instance sho
jlebel
2017/01/11 14:25:24
Done.
| |
| 50 | 52 |
| 51 // Either navigates back in the signin flow if the history state allows it or | 53 // Either navigates back in the signin flow if the history state allows it or |
| 52 // closes the flow otherwise. | 54 // closes the flow otherwise. If view is closed, the instance should be |
| 55 // considered has being destroyed. | |
| 53 void PerformNavigation(); | 56 void PerformNavigation(); |
| 54 | 57 |
| 55 // This will be called by the base class to request a resize of the native | 58 // 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 | 59 // view hosting the content to |height|. |height| is the total height of the |
| 57 // content, in pixels. | 60 // content, in pixels. |
| 58 virtual void ResizeNativeView(int height) = 0; | 61 virtual void ResizeNativeView(int height) = 0; |
| 59 | 62 |
| 60 // content::WebContentsDelegate: | 63 // content::WebContentsDelegate: |
| 61 bool HandleContextMenu(const content::ContextMenuParams& params) override; | 64 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
| 62 | 65 |
| 63 // WebContents is used for executing javascript in the context of a modal sync | 66 // WebContents is used for executing javascript in the context of a modal sync |
| 64 // confirmation dialog. | 67 // confirmation dialog. |
| 65 content::WebContents* web_contents_for_testing() { return web_contents_; } | 68 content::WebContents* web_contents_for_testing() { return web_contents_; } |
| 66 | 69 |
| 67 protected: | 70 protected: |
| 71 // The presentation type of the modal sign-in dialog. | |
| 72 enum DialogModalType { | |
| 73 // The sign-in dialog is presented as tab modal: the user may interact with | |
| 74 // the parent window and the dialog is dismissed on tab navigation. | |
| 75 TAB_MODAL, | |
| 76 | |
| 77 // The sign-in dialog is presented as window modal: the user cannot interact | |
| 78 // with the parent window an | |
| 79 WINDOW_MODAL | |
| 80 }; | |
| 81 | |
| 68 SigninViewControllerDelegate(SigninViewController* signin_view_controller, | 82 SigninViewControllerDelegate(SigninViewController* signin_view_controller, |
| 69 content::WebContents* web_contents); | 83 content::WebContents* web_contents); |
| 70 ~SigninViewControllerDelegate() override; | 84 ~SigninViewControllerDelegate() override; |
| 71 | 85 |
| 72 // Notifies the SigninViewController that this instance is being deleted. | 86 // Notifies the SigninViewController that this instance is being deleted. |
| 73 void ResetSigninViewControllerDelegate(); | 87 void ResetSigninViewControllerDelegate(); |
| 74 | 88 |
| 75 // content::WebContentsDelegate | 89 // content::WebContentsDelegate |
| 76 void LoadingStateChanged(content::WebContents* source, | 90 void LoadingStateChanged(content::WebContents* source, |
| 77 bool to_different_document) override; | 91 bool to_different_document) override; |
| 78 | 92 |
| 79 // This will be called by this base class when the tab-modal window must be | 93 // 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 | 94 // closed. This should close the platform-specific window that is currently |
| 81 // showing the sign in flow or the sync confirmation dialog. | 95 // showing the sign in flow or the sync confirmation dialog. After this call, |
| 96 // the current instance should be considered has being destroyed. | |
| 82 virtual void PerformClose() = 0; | 97 virtual void PerformClose() = 0; |
| 83 | 98 |
| 84 private: | 99 private: |
| 85 bool CanGoBack(content::WebContents* web_ui_web_contents) const; | 100 bool CanGoBack(content::WebContents* web_ui_web_contents) const; |
| 86 | 101 |
| 87 SigninViewController* signin_view_controller_; // Not owned. | 102 SigninViewController* signin_view_controller_; // Not owned. |
| 88 content::WebContents* web_contents_; // Not owned. | 103 content::WebContents* web_contents_; // Not owned. |
| 89 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegate); | 104 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegate); |
| 90 }; | 105 }; |
| 91 | 106 |
| 92 #endif // CHROME_BROWSER_UI_SIGNIN_VIEW_CONTROLLER_DELEGATE_H_ | 107 #endif // CHROME_BROWSER_UI_SIGNIN_VIEW_CONTROLLER_DELEGATE_H_ |
| OLD | NEW |