Chromium Code Reviews| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | 12 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" |
| 13 #include "chrome/browser/ui/profile_chooser_constants.h" | 13 #include "chrome/browser/ui/profile_chooser_constants.h" |
| 14 #include "chrome/browser/ui/signin_view_controller_delegate.h" | 14 #include "chrome/browser/ui/signin_view_controller_delegate.h" |
| 15 #include "ui/base/ui_base_types.h" | |
| 15 | 16 |
| 16 @class ConstrainedWindowCustomWindow; | 17 @class ConstrainedWindowCustomWindow; |
| 17 class ConstrainedWindowMac; | 18 class ConstrainedWindowMac; |
| 18 class Profile; | 19 class Profile; |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 class WebContents; | 22 class WebContents; |
| 22 class WebContentsDelegate; | 23 class WebContentsDelegate; |
| 23 } | 24 } |
| 24 | 25 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 36 // Creates and displays a constrained window off of |host_web_contents|, | 37 // 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 // 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 // wait for ResizeNativeView() to be called by the base class before |
| 39 // displaying the constrained window. Otherwise, the window's dimensions will | 40 // displaying the constrained window. Otherwise, the window's dimensions will |
| 40 // be |frame|. | 41 // be |frame|. |
| 41 SigninViewControllerDelegateMac( | 42 SigninViewControllerDelegateMac( |
| 42 SigninViewController* signin_view_controller, | 43 SigninViewController* signin_view_controller, |
| 43 std::unique_ptr<content::WebContents> web_contents, | 44 std::unique_ptr<content::WebContents> web_contents, |
| 44 content::WebContents* host_web_contents, | 45 content::WebContents* host_web_contents, |
| 45 NSRect frame, | 46 NSRect frame, |
| 47 ui::ModalType dialog_modal_type, | |
|
msarda
2017/01/11 14:29:21
For consistency with the views implementation, ple
jlebel
2017/01/11 14:39:52
Done.
| |
| 46 bool wait_for_size); | 48 bool wait_for_size); |
| 47 | 49 |
| 48 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; | 50 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; |
| 49 | 51 |
| 50 // Creates the web view that contains the signin flow in |mode| using | 52 // 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 | 53 // |profile| as the web content's profile, then sets |delegate| as the created |
| 52 // web content's delegate. | 54 // web content's delegate. |
| 53 static std::unique_ptr<content::WebContents> CreateGaiaWebContents( | 55 static std::unique_ptr<content::WebContents> CreateGaiaWebContents( |
| 54 content::WebContentsDelegate* delegate, | 56 content::WebContentsDelegate* delegate, |
| 55 profiles::BubbleViewMode mode, | 57 profiles::BubbleViewMode mode, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 67 void ResizeNativeView(int height) override; | 69 void ResizeNativeView(int height) override; |
| 68 | 70 |
| 69 void DisplayModal(); | 71 void DisplayModal(); |
| 70 | 72 |
| 71 void HandleKeyboardEvent( | 73 void HandleKeyboardEvent( |
| 72 content::WebContents* source, | 74 content::WebContents* source, |
| 73 const content::NativeWebKeyboardEvent& event) override; | 75 const content::NativeWebKeyboardEvent& event) override; |
| 74 | 76 |
| 75 ~SigninViewControllerDelegateMac() override; | 77 ~SigninViewControllerDelegateMac() override; |
| 76 | 78 |
| 79 // Deletes this object. | |
| 80 void DeleteThis(); | |
| 81 | |
| 77 // The constrained window opened by this delegate to display signin flow | 82 // The constrained window opened by this delegate to display signin flow |
| 78 // content. | 83 // content. |
| 79 std::unique_ptr<ConstrainedWindowMac> constrained_window_; | 84 std::unique_ptr<ConstrainedWindowMac> constrained_window_; |
| 80 | 85 |
| 81 // The web contents displayed in the constrained window. | 86 // The web contents displayed in the constrained window. |
| 82 std::unique_ptr<content::WebContents> web_contents_; | 87 std::unique_ptr<content::WebContents> web_contents_; |
| 83 base::scoped_nsobject<ConstrainedWindowCustomWindow> window_; | 88 base::scoped_nsobject<ConstrainedWindowCustomWindow> window_; |
| 84 | 89 |
| 85 // wait_for_size_ stores whether the dialog should only be shown after its | 90 // wait_for_size_ stores whether the dialog should only be shown after its |
| 86 // content's size has been laid out and measured so that the constrained | 91 // content's size has been laid out and measured so that the constrained |
| 87 // window is sized to the content. | 92 // window is sized to the content. |
| 88 bool wait_for_size_; | 93 bool wait_for_size_; |
| 89 | 94 |
| 90 // The web contents that the constrained window is displayed off of. | 95 // The web contents that the constrained window is displayed off of. |
| 91 // Typically, this is going to be the active tab when the window is shown. | 96 // Typically, this is going to be the active tab when the window is shown. |
| 92 content::WebContents* host_web_contents_; | 97 content::WebContents* host_web_contents_; |
| 98 | |
| 99 // The dialog modal presentation type. | |
| 100 ui::ModalType dialog_modal_type_; | |
| 101 | |
| 93 NSRect window_frame_; | 102 NSRect window_frame_; |
| 94 | 103 |
| 95 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegateMac); | 104 DISALLOW_COPY_AND_ASSIGN(SigninViewControllerDelegateMac); |
| 96 }; | 105 }; |
| 97 | 106 |
| 98 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_MAC_ H_ | 107 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_SIGNIN_VIEW_CONTROLLER_DELEGATE_MAC_ H_ |
| OLD | NEW |