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_COCOA_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_MAC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_MAC_H_ |
6 #define CHROME_BROWSER_UI_COCOA_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_MAC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_MAC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // Instances of this class delete themselves when the window they manage is | 31 // Instances of this class delete themselves when the window they manage is |
32 // closed (in the OnConstrainedWindowClosed callback). | 32 // closed (in the OnConstrainedWindowClosed callback). |
33 class SigninViewControllerDelegateMac : public ConstrainedWindowMacDelegate, | 33 class SigninViewControllerDelegateMac : public ConstrainedWindowMacDelegate, |
34 public SigninViewControllerDelegate { | 34 public SigninViewControllerDelegate { |
35 public: | 35 public: |
36 // Creates and displays a constrained window off of |host_web_contents|, | 36 // Creates and displays a constrained window off of |host_web_contents|, |
37 // containing |web_contents|. If |wait_for_size| is true, the delegate will | 37 // containing |web_contents|. If |wait_for_size| is true, the delegate will |
38 // wait for ResizeNativeView() to be called by the base class before | 38 // wait for ResizeNativeView() to be called by the base class before |
39 // displaying the constrained window. Otherwise, the window's dimensions will | 39 // displaying the constrained window. Otherwise, the window's dimensions will |
40 // be |frame|. | 40 // be |frame|. |
41 SigninViewControllerDelegateMac(SigninViewController* signin_view_controller, | 41 SigninViewControllerDelegateMac( |
42 scoped_ptr<content::WebContents> web_contents, | 42 SigninViewController* signin_view_controller, |
43 content::WebContents* host_web_contents, | 43 std::unique_ptr<content::WebContents> web_contents, |
44 NSRect frame, | 44 content::WebContents* host_web_contents, |
45 bool wait_for_size); | 45 NSRect frame, |
| 46 bool wait_for_size); |
46 | 47 |
47 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; | 48 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; |
48 | 49 |
49 // Creates the web view that contains the signin flow in |mode| using | 50 // Creates the web view that contains the signin flow in |mode| using |
50 // |profile| as the web content's profile, then sets |delegate| as the created | 51 // |profile| as the web content's profile, then sets |delegate| as the created |
51 // web content's delegate. | 52 // web content's delegate. |
52 static scoped_ptr<content::WebContents> CreateGaiaWebContents( | 53 static std::unique_ptr<content::WebContents> CreateGaiaWebContents( |
53 content::WebContentsDelegate* delegate, | 54 content::WebContentsDelegate* delegate, |
54 profiles::BubbleViewMode mode, | 55 profiles::BubbleViewMode mode, |
55 Profile* profile, | 56 Profile* profile, |
56 signin_metrics::AccessPoint access_point); | 57 signin_metrics::AccessPoint access_point); |
57 | 58 |
58 static scoped_ptr<content::WebContents> CreateSyncConfirmationWebContents( | 59 static std::unique_ptr<content::WebContents> |
59 Profile* profile); | 60 CreateSyncConfirmationWebContents(Profile* profile); |
60 | 61 |
61 private: | 62 private: |
62 void PerformClose() override; | 63 void PerformClose() override; |
63 void ResizeNativeView(int height) override; | 64 void ResizeNativeView(int height) override; |
64 | 65 |
65 void DisplayModal(); | 66 void DisplayModal(); |
66 | 67 |
67 void HandleKeyboardEvent( | 68 void HandleKeyboardEvent( |
68 content::WebContents* source, | 69 content::WebContents* source, |
69 const content::NativeWebKeyboardEvent& event) override; | 70 const content::NativeWebKeyboardEvent& event) override; |
70 | 71 |
71 ~SigninViewControllerDelegateMac() override; | 72 ~SigninViewControllerDelegateMac() override; |
72 | 73 |
73 // The constrained window opened by this delegate to display signin flow | 74 // The constrained window opened by this delegate to display signin flow |
74 // content. | 75 // content. |
75 scoped_ptr<ConstrainedWindowMac> constrained_window_; | 76 std::unique_ptr<ConstrainedWindowMac> constrained_window_; |
76 | 77 |
77 // The web contents displayed in the constrained window. | 78 // The web contents displayed in the constrained window. |
78 scoped_ptr<content::WebContents> web_contents_; | 79 std::unique_ptr<content::WebContents> web_contents_; |
79 base::scoped_nsobject<ConstrainedWindowCustomWindow> window_; | 80 base::scoped_nsobject<ConstrainedWindowCustomWindow> window_; |
80 | 81 |
81 // wait_for_size_ stores whether the dialog should only be shown after its | 82 // wait_for_size_ stores whether the dialog should only be shown after its |
82 // content's size has been laid out and measured so that the constrained | 83 // content's size has been laid out and measured so that the constrained |
83 // window is sized to the content. | 84 // window is sized to the content. |
84 bool wait_for_size_; | 85 bool wait_for_size_; |
85 | 86 |
86 // The web contents that the constrained window is displayed off of. | 87 // The web contents that the constrained window is displayed off of. |
87 // Typically, this is going to be the active tab when the window is shown. | 88 // Typically, this is going to be the active tab when the window is shown. |
88 content::WebContents* host_web_contents_; | 89 content::WebContents* host_web_contents_; |
89 NSRect window_frame_; | 90 NSRect window_frame_; |
90 | 91 |
91 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegateMac); | 92 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegateMac); |
92 }; | 93 }; |
93 | 94 |
94 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_MAC_
H_ | 95 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_MAC_
H_ |
OLD | NEW |