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 |
11 class Browser; | 11 class Browser; |
12 class ModalSigninDelegate; | 12 class ModalSigninDelegate; |
13 class SigninViewController; | 13 class SigninViewController; |
14 | 14 |
15 namespace signin_metrics { | 15 namespace signin_metrics { |
16 enum class AccessPoint; | 16 enum class AccessPoint; |
17 } | 17 } |
18 | 18 |
19 // Abstract base class to the platform-specific managers of the Signin and Sync | 19 // Abstract base class to the platform-specific managers of the Signin and Sync |
20 // confirmation tab-modal dialogs. This and its platform-specific | 20 // confirmation tab-modal dialogs. This and its platform-specific |
21 // implementations are responsible for actually creating and owning the dialogs, | 21 // implementations are responsible for actually creating and owning the dialogs, |
22 // as well as managing the navigation inside them. | 22 // as well as managing the navigation inside them. |
23 // Subclasses are responsible for deleting themselves when the window they're | 23 // Subclasses are responsible for deleting themselves when the window they're |
24 // managing closes. | 24 // managing closes. |
25 class SigninViewControllerDelegate : public content::WebContentsDelegate { | 25 class SigninViewControllerDelegate : public content::WebContentsDelegate { |
26 public: | 26 public: |
| 27 // Returns a platform-specific SigninViewControllerDelegate instance that |
| 28 // displays the sign in flow. The returned object should delete itself when |
| 29 // the window it's managing is closed. |
27 static SigninViewControllerDelegate* CreateModalSigninDelegate( | 30 static SigninViewControllerDelegate* CreateModalSigninDelegate( |
28 SigninViewController* signin_view_controller, | 31 SigninViewController* signin_view_controller, |
29 profiles::BubbleViewMode mode, | 32 profiles::BubbleViewMode mode, |
30 Browser* browser, | 33 Browser* browser, |
31 signin_metrics::AccessPoint access_point); | 34 signin_metrics::AccessPoint access_point); |
32 | 35 |
| 36 // Returns a platform-specific SigninViewControllerDelegate instance that |
| 37 // displays the sync confirmation dialog. The returned object should delete |
| 38 // itself when the window it's managing is closed. |
33 static SigninViewControllerDelegate* CreateSyncConfirmationDelegate( | 39 static SigninViewControllerDelegate* CreateSyncConfirmationDelegate( |
34 SigninViewController* signin_view_controller, | 40 SigninViewController* signin_view_controller, |
35 Browser* browser); | 41 Browser* browser); |
36 | 42 |
| 43 // Returns a platform-specific SigninViewControllerDelegate instance that |
| 44 // displays the modal sign in error dialog. The returned object should delete |
| 45 // itself when the window it's managing is closed. |
| 46 static SigninViewControllerDelegate* CreateSigninErrorDelegate( |
| 47 SigninViewController* signin_view_controller, |
| 48 Browser* browser); |
| 49 |
37 void CloseModalSignin(); | 50 void CloseModalSignin(); |
38 | 51 |
39 // 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 |
40 // closes the flow otherwise. | 53 // closes the flow otherwise. |
41 void PerformNavigation(); | 54 void PerformNavigation(); |
42 | 55 |
43 // 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 |
44 // 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 |
45 // content, in pixels. | 58 // content, in pixels. |
46 virtual void ResizeNativeView(int height) = 0; | 59 virtual void ResizeNativeView(int height) = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
71 | 84 |
72 private: | 85 private: |
73 bool CanGoBack(content::WebContents* web_ui_web_contents) const; | 86 bool CanGoBack(content::WebContents* web_ui_web_contents) const; |
74 | 87 |
75 SigninViewController* signin_view_controller_; // Not owned. | 88 SigninViewController* signin_view_controller_; // Not owned. |
76 content::WebContents* web_contents_; // Not owned. | 89 content::WebContents* web_contents_; // Not owned. |
77 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegate); | 90 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegate); |
78 }; | 91 }; |
79 | 92 |
80 #endif // CHROME_BROWSER_UI_SIGNIN_VIEW_CONTROLLER_DELEGATE_H_ | 93 #endif // CHROME_BROWSER_UI_SIGNIN_VIEW_CONTROLLER_DELEGATE_H_ |
OLD | NEW |