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_VIEWS_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_VIEWS_H
_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_VIEWS_H
_ |
6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_VIEWS_H
_ | 6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_VIEWS_H
_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/ui/profile_chooser_constants.h" | 9 #include "chrome/browser/ui/profile_chooser_constants.h" |
10 #include "chrome/browser/ui/signin_view_controller_delegate.h" | 10 #include "chrome/browser/ui/signin_view_controller_delegate.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class WebView; | 24 class WebView; |
25 } | 25 } |
26 | 26 |
27 // Views implementation of SigninViewControllerDelegate. It's responsible for | 27 // Views implementation of SigninViewControllerDelegate. It's responsible for |
28 // managing the Signin and Sync Confirmation tab-modal dialogs. | 28 // managing the Signin and Sync Confirmation tab-modal dialogs. |
29 // Instances of this class delete themselves when the window they're managing | 29 // Instances of this class delete themselves when the window they're managing |
30 // closes (in the DeleteDelegate callback). | 30 // closes (in the DeleteDelegate callback). |
31 class SigninViewControllerDelegateViews : public views::DialogDelegateView, | 31 class SigninViewControllerDelegateViews : public views::DialogDelegateView, |
32 public SigninViewControllerDelegate { | 32 public SigninViewControllerDelegate { |
33 public: | 33 public: |
34 // Creates and displays a constrained window containing |web_contents|. If | |
35 // |wait_for_size| is true, the delegate will wait for ResizeNativeView() to | |
36 // be called by the base class before displaying the constrained window. | |
37 SigninViewControllerDelegateViews( | |
38 SigninViewController* signin_view_controller, | |
39 std::unique_ptr<views::WebView> content_view, | |
40 Browser* browser, | |
41 bool wait_for_size); | |
42 | |
43 // Creates the web view that contains the signin flow in |mode| using | 34 // Creates the web view that contains the signin flow in |mode| using |
44 // |profile| as the web content's profile, then sets |delegate| as the created | 35 // |profile| as the web content's profile, then sets |delegate| as the created |
45 // web content's delegate. | 36 // web content's delegate. |
46 static std::unique_ptr<views::WebView> CreateGaiaWebView( | 37 static std::unique_ptr<views::WebView> CreateGaiaWebView( |
47 content::WebContentsDelegate* delegate, | 38 content::WebContentsDelegate* delegate, |
48 profiles::BubbleViewMode mode, | 39 profiles::BubbleViewMode mode, |
49 Browser* browser, | 40 Browser* browser, |
50 signin_metrics::AccessPoint access_point); | 41 signin_metrics::AccessPoint access_point); |
51 | 42 |
52 static std::unique_ptr<views::WebView> CreateSyncConfirmationWebView( | 43 static std::unique_ptr<views::WebView> CreateSyncConfirmationWebView( |
53 Browser* browser); | 44 Browser* browser); |
54 | 45 |
55 static std::unique_ptr<views::WebView> CreateSigninErrorWebView( | 46 static std::unique_ptr<views::WebView> CreateSigninErrorWebView( |
56 Browser* browser); | 47 Browser* browser); |
57 | 48 |
58 // views::DialogDelegateView: | 49 // views::DialogDelegateView: |
59 views::View* GetContentsView() override; | 50 views::View* GetContentsView() override; |
60 views::Widget* GetWidget() override; | 51 views::Widget* GetWidget() override; |
61 const views::Widget* GetWidget() const override; | 52 const views::Widget* GetWidget() const override; |
62 void DeleteDelegate() override; | 53 void DeleteDelegate() override; |
63 ui::ModalType GetModalType() const override; | 54 ui::ModalType GetModalType() const override; |
64 bool ShouldShowCloseButton() const override; | 55 bool ShouldShowCloseButton() const override; |
65 int GetDialogButtons() const override; | 56 int GetDialogButtons() const override; |
66 | 57 |
67 private: | 58 private: |
| 59 friend SigninViewControllerDelegate; |
| 60 |
| 61 // Creates and displays a constrained window containing |web_contents|. If |
| 62 // |wait_for_size| is true, the delegate will wait for ResizeNativeView() to |
| 63 // be called by the base class before displaying the constrained window. |
| 64 SigninViewControllerDelegateViews( |
| 65 SigninViewController* signin_view_controller, |
| 66 std::unique_ptr<views::WebView> content_view, |
| 67 Browser* browser, |
| 68 ui::ModalType dialog_modal_type, |
| 69 bool wait_for_size); |
| 70 ~SigninViewControllerDelegateViews() override; |
| 71 |
68 void PerformClose() override; | 72 void PerformClose() override; |
69 void ResizeNativeView(int height) override; | 73 void ResizeNativeView(int height) override; |
70 | 74 |
71 void DisplayModal(); | 75 void DisplayModal(); |
72 | 76 |
73 ~SigninViewControllerDelegateViews() override; | |
74 | |
75 views::WebView* content_view_; | 77 views::WebView* content_view_; |
76 views::Widget* modal_signin_widget_; // Not owned. | 78 views::Widget* modal_signin_widget_; // Not owned. |
| 79 ui::ModalType dialog_modal_type_; |
77 | 80 |
78 // wait_for_size_ stores whether the dialog should only be shown after its | 81 // wait_for_size_ stores whether the dialog should only be shown after its |
79 // content's size has been laid out and measured so that the constrained | 82 // content's size has been laid out and measured so that the constrained |
80 // window is sized to the content. | 83 // window is sized to the content. |
81 bool wait_for_size_; | 84 bool wait_for_size_; |
82 Browser* browser_; | 85 Browser* browser_; |
83 | 86 |
84 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegateViews); | 87 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegateViews); |
85 }; | 88 }; |
86 | 89 |
87 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_VIEW
S_H_ | 90 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_VIEW
S_H_ |
OLD | NEW |