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 // Closes the sign-in dialog. Note that this method may destroy this object, |
| 50 // so the caller should no longer use this object after calling this method. |
50 void CloseModalSignin(); | 51 void CloseModalSignin(); |
51 | 52 |
52 // 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 |
53 // closes the flow otherwise. | 54 // closes the flow otherwise. Note that if view is closed, this method may |
| 55 // destroy this object, so the caller should no longer use this object after |
| 56 // calling this method. |
54 void PerformNavigation(); | 57 void PerformNavigation(); |
55 | 58 |
56 // This will be called by the base class to request a resize of the native | 59 // This will be called by the base class to request a resize of the native |
57 // view hosting the content to |height|. |height| is the total height of the | 60 // view hosting the content to |height|. |height| is the total height of the |
58 // content, in pixels. | 61 // content, in pixels. |
59 virtual void ResizeNativeView(int height) = 0; | 62 virtual void ResizeNativeView(int height) = 0; |
60 | 63 |
61 // content::WebContentsDelegate: | 64 // content::WebContentsDelegate: |
62 bool HandleContextMenu(const content::ContextMenuParams& params) override; | 65 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
63 | 66 |
64 // WebContents is used for executing javascript in the context of a modal sync | 67 // WebContents is used for executing javascript in the context of a modal sync |
65 // confirmation dialog. | 68 // confirmation dialog. |
66 content::WebContents* web_contents_for_testing() { return web_contents_; } | 69 content::WebContents* web_contents_for_testing() { return web_contents_; } |
67 | 70 |
68 protected: | 71 protected: |
69 SigninViewControllerDelegate(SigninViewController* signin_view_controller, | 72 SigninViewControllerDelegate(SigninViewController* signin_view_controller, |
70 content::WebContents* web_contents); | 73 content::WebContents* web_contents); |
71 ~SigninViewControllerDelegate() override; | 74 ~SigninViewControllerDelegate() override; |
72 | 75 |
73 // Notifies the SigninViewController that this instance is being deleted. | 76 // Notifies the SigninViewController that this instance is being deleted. |
74 void ResetSigninViewControllerDelegate(); | 77 void ResetSigninViewControllerDelegate(); |
75 | 78 |
76 // content::WebContentsDelegate | 79 // content::WebContentsDelegate |
77 void LoadingStateChanged(content::WebContents* source, | 80 void LoadingStateChanged(content::WebContents* source, |
78 bool to_different_document) override; | 81 bool to_different_document) override; |
79 | 82 |
80 // This will be called by this base class when the tab-modal window must be | 83 // This will be called by this base class when the tab-modal window must be |
81 // closed. This should close the platform-specific window that is currently | 84 // closed. This should close the platform-specific window that is currently |
82 // showing the sign in flow or the sync confirmation dialog. | 85 // showing the sign in flow or the sync confirmation dialog. Note that this |
| 86 // method may destroy this object, so the caller should no longer use this |
| 87 // object after calling this method. |
83 virtual void PerformClose() = 0; | 88 virtual void PerformClose() = 0; |
84 | 89 |
85 private: | 90 private: |
86 bool CanGoBack(content::WebContents* web_ui_web_contents) const; | 91 bool CanGoBack(content::WebContents* web_ui_web_contents) const; |
87 | 92 |
88 SigninViewController* signin_view_controller_; // Not owned. | 93 SigninViewController* signin_view_controller_; // Not owned. |
89 content::WebContents* web_contents_; // Not owned. | 94 content::WebContents* web_contents_; // Not owned. |
90 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegate); | 95 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegate); |
91 }; | 96 }; |
92 | 97 |
93 #endif // CHROME_BROWSER_UI_SIGNIN_VIEW_CONTROLLER_DELEGATE_H_ | 98 #endif // CHROME_BROWSER_UI_SIGNIN_VIEW_CONTROLLER_DELEGATE_H_ |
OLD | NEW |