| 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 15 matching lines...) Expand all Loading... |
| 26 enum class AccessPoint; | 26 enum class AccessPoint; |
| 27 } | 27 } |
| 28 | 28 |
| 29 // Cocoa implementation of SigninViewControllerDelegate. It's responsible for | 29 // Cocoa implementation of SigninViewControllerDelegate. It's responsible for |
| 30 // managing the Signin and Sync Confirmation tab-modal dialogs. | 30 // managing the Signin and Sync Confirmation tab-modal dialogs. |
| 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|, |
| 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 |
| 39 // displaying the constrained window. Otherwise, the window's dimensions will |
| 40 // be |frame|. |
| 36 SigninViewControllerDelegateMac(SigninViewController* signin_view_controller, | 41 SigninViewControllerDelegateMac(SigninViewController* signin_view_controller, |
| 37 scoped_ptr<content::WebContents> web_contents, | 42 scoped_ptr<content::WebContents> web_contents, |
| 38 content::WebContents* host_web_contents, | 43 content::WebContents* host_web_contents, |
| 39 NSRect frame); | 44 NSRect frame, |
| 40 | 45 bool wait_for_size); |
| 41 static | |
| 42 SigninViewControllerDelegateMac* CreateModalSigninDelegateWithNavigation( | |
| 43 SigninViewController* signin_view_controller, | |
| 44 scoped_ptr<content::WebContents> web_contents, | |
| 45 content::WebContents* host_web_contents, | |
| 46 NSRect frame); | |
| 47 | 46 |
| 48 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; | 47 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; |
| 49 | 48 |
| 50 // Creates the web view that contains the signin flow in |mode| using | 49 // Creates the web view that contains the signin flow in |mode| using |
| 51 // |profile| as the web content's profile, then sets |delegate| as the created | 50 // |profile| as the web content's profile, then sets |delegate| as the created |
| 52 // web content's delegate. | 51 // web content's delegate. |
| 53 static scoped_ptr<content::WebContents> CreateGaiaWebContents( | 52 static scoped_ptr<content::WebContents> CreateGaiaWebContents( |
| 54 content::WebContentsDelegate* delegate, | 53 content::WebContentsDelegate* delegate, |
| 55 profiles::BubbleViewMode mode, | 54 profiles::BubbleViewMode mode, |
| 56 Profile* profile, | 55 Profile* profile, |
| 57 signin_metrics::AccessPoint access_point); | 56 signin_metrics::AccessPoint access_point); |
| 58 | 57 |
| 59 static scoped_ptr<content::WebContents> CreateSyncConfirmationWebContents( | 58 static scoped_ptr<content::WebContents> CreateSyncConfirmationWebContents( |
| 60 Profile* profile); | 59 Profile* profile); |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 void PerformClose() override; | 62 void PerformClose() override; |
| 63 void ResizeNativeView(int height) override; |
| 64 |
| 65 void DisplayModal(); |
| 64 | 66 |
| 65 ~SigninViewControllerDelegateMac() override; | 67 ~SigninViewControllerDelegateMac() override; |
| 66 | 68 |
| 69 // The constrained window opened by this delegate to display signin flow |
| 70 // content. |
| 67 scoped_ptr<ConstrainedWindowMac> constrained_window_; | 71 scoped_ptr<ConstrainedWindowMac> constrained_window_; |
| 72 |
| 73 // The web contents displayed in the constrained window. |
| 68 scoped_ptr<content::WebContents> web_contents_; | 74 scoped_ptr<content::WebContents> web_contents_; |
| 69 base::scoped_nsobject<ConstrainedWindowCustomWindow> window_; | 75 base::scoped_nsobject<ConstrainedWindowCustomWindow> window_; |
| 70 | 76 |
| 77 // wait_for_size_ stores whether the dialog should only be shown after its |
| 78 // content's size has been laid out and measured so that the constrained |
| 79 // window is sized to the content. |
| 80 bool wait_for_size_; |
| 81 |
| 82 // The web contents that the constrained window is displayed off of. |
| 83 // Typically, this is going to be the active tab when the window is shown. |
| 84 content::WebContents* host_web_contents_; |
| 85 NSRect window_frame_; |
| 86 |
| 71 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegateMac); | 87 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegateMac); |
| 72 }; | 88 }; |
| 73 | 89 |
| 74 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_MAC_
H_ | 90 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_MAC_
H_ |
| OLD | NEW |