OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ | 5 #ifndef COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ |
6 #define COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ | 6 #define COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
brettw
2016/08/17 17:49:55
You should include build/build_config.h for OS_MAC
Patti Lor
2016/08/18 03:05:49
Done, thanks for picking that up!
| |
12 #include "components/web_modal/single_web_contents_dialog_manager.h" | 12 #include "components/web_modal/single_web_contents_dialog_manager.h" |
13 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
14 #include "content/public/browser/web_contents_user_data.h" | 14 #include "content/public/browser/web_contents_user_data.h" |
15 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
16 | 16 |
17 namespace web_modal { | 17 namespace web_modal { |
18 | 18 |
19 class WebContentsModalDialogManagerDelegate; | 19 class WebContentsModalDialogManagerDelegate; |
20 | 20 |
21 // Per-WebContents class to manage WebContents-modal dialogs. | 21 // Per-WebContents class to manage WebContents-modal dialogs. |
22 class WebContentsModalDialogManager | 22 class WebContentsModalDialogManager |
23 : public SingleWebContentsDialogManagerDelegate, | 23 : public SingleWebContentsDialogManagerDelegate, |
24 public content::WebContentsObserver, | 24 public content::WebContentsObserver, |
25 public content::WebContentsUserData<WebContentsModalDialogManager> { | 25 public content::WebContentsUserData<WebContentsModalDialogManager> { |
26 public: | 26 public: |
27 ~WebContentsModalDialogManager() override; | 27 ~WebContentsModalDialogManager() override; |
28 | 28 |
29 WebContentsModalDialogManagerDelegate* delegate() const { return delegate_; } | 29 WebContentsModalDialogManagerDelegate* delegate() const { return delegate_; } |
30 void SetDelegate(WebContentsModalDialogManagerDelegate* d); | 30 void SetDelegate(WebContentsModalDialogManagerDelegate* d); |
31 | 31 |
32 #if defined(OS_MACOSX) | |
33 // Note: This method is not defined inside components/web_modal/ as its | |
34 // definition (needed for Cocoa builds) depends on chrome/browser/ui/cocoa/. | |
32 static SingleWebContentsDialogManager* CreateNativeWebModalManager( | 35 static SingleWebContentsDialogManager* CreateNativeWebModalManager( |
33 gfx::NativeWindow dialog, | 36 gfx::NativeWindow dialog, |
34 SingleWebContentsDialogManagerDelegate* native_delegate); | 37 SingleWebContentsDialogManagerDelegate* native_delegate); |
35 | 38 #endif |
36 // Shows the dialog as a web contents modal dialog. The dialog will notify via | |
37 // WillClose() when it is being destroyed. | |
38 void ShowModalDialog(gfx::NativeWindow dialog); | |
39 | 39 |
40 // Allow clients to supply their own native dialog manager. Suitable for | 40 // Allow clients to supply their own native dialog manager. Suitable for |
41 // bubble clients. | 41 // bubble clients. |
42 void ShowDialogWithManager( | 42 void ShowDialogWithManager( |
43 gfx::NativeWindow dialog, | 43 gfx::NativeWindow dialog, |
44 std::unique_ptr<SingleWebContentsDialogManager> manager); | 44 std::unique_ptr<SingleWebContentsDialogManager> manager); |
45 | 45 |
46 // Returns true if any dialogs are active and not closed. | 46 // Returns true if any dialogs are active and not closed. |
47 bool IsDialogActive() const; | 47 bool IsDialogActive() const; |
48 | 48 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 | 116 |
117 // True while closing the dialogs on WebContents close. | 117 // True while closing the dialogs on WebContents close. |
118 bool closing_all_dialogs_; | 118 bool closing_all_dialogs_; |
119 | 119 |
120 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogManager); | 120 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogManager); |
121 }; | 121 }; |
122 | 122 |
123 } // namespace web_modal | 123 } // namespace web_modal |
124 | 124 |
125 #endif // COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ | 125 #endif // COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ |
OLD | NEW |