OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "ui/base/ui_base_types.h" | 13 #include "ui/base/ui_base_types.h" |
14 #include "webkit/glue/window_open_disposition.h" | 14 #include "webkit/glue/window_open_disposition.h" |
15 | 15 |
16 class GURL; | 16 class GURL; |
17 | 17 |
18 namespace content { | 18 namespace content { |
| 19 class RenderViewHost; |
| 20 class WebContents; |
| 21 class WebUI; |
19 class WebUIMessageHandler; | 22 class WebUIMessageHandler; |
20 class WebContents; | |
21 struct ContextMenuParams; | 23 struct ContextMenuParams; |
22 struct OpenURLParams; | 24 struct OpenURLParams; |
23 } | 25 } |
24 | 26 |
25 namespace gfx { | 27 namespace gfx { |
26 class Rect; | 28 class Rect; |
27 class Size; | 29 class Size; |
28 } | 30 } |
29 | 31 |
30 // Implement this class to receive notifications. | 32 // Implement this class to receive notifications. |
(...skipping 25 matching lines...) Expand all Loading... |
56 // Get the size of the dialog. | 58 // Get the size of the dialog. |
57 virtual void GetMinimumDialogSize(gfx::Size* size) const; | 59 virtual void GetMinimumDialogSize(gfx::Size* size) const; |
58 | 60 |
59 // Gets the JSON string input to use when showing the dialog. | 61 // Gets the JSON string input to use when showing the dialog. |
60 virtual std::string GetDialogArgs() const = 0; | 62 virtual std::string GetDialogArgs() const = 0; |
61 | 63 |
62 // A callback to notify the delegate that |source|'s loading state has | 64 // A callback to notify the delegate that |source|'s loading state has |
63 // changed. | 65 // changed. |
64 virtual void OnLoadingStateChanged(content::WebContents* source) {} | 66 virtual void OnLoadingStateChanged(content::WebContents* source) {} |
65 | 67 |
| 68 // A callback to notify the delegate that a web dialog has been shown. |
| 69 // |webui| is the WebUI with which the dialog is associated. |
| 70 // |render_view_host| is the RenderViewHost for the shown dialog. |
| 71 virtual void OnDialogShown(content::WebUI* webui, |
| 72 content::RenderViewHost* render_view_host) {} |
| 73 |
66 // A callback to notify the delegate that the dialog closed. | 74 // A callback to notify the delegate that the dialog closed. |
67 // IMPORTANT: Implementations should delete |this| here (unless they've | 75 // IMPORTANT: Implementations should delete |this| here (unless they've |
68 // arranged for the delegate to be deleted in some other way, e.g. by | 76 // arranged for the delegate to be deleted in some other way, e.g. by |
69 // registering it as a message handler in the WebUI object). | 77 // registering it as a message handler in the WebUI object). |
70 virtual void OnDialogClosed(const std::string& json_retval) = 0; | 78 virtual void OnDialogClosed(const std::string& json_retval) = 0; |
71 | 79 |
72 // A callback to notify the delegate that the contents have gone | 80 // A callback to notify the delegate that the contents have gone |
73 // away. Only relevant if your dialog hosts code that calls | 81 // away. Only relevant if your dialog hosts code that calls |
74 // windows.close() and you've allowed that. If the output parameter | 82 // windows.close() and you've allowed that. If the output parameter |
75 // is set to true, then the dialog is closed. The default is false. | 83 // is set to true, then the dialog is closed. The default is false. |
(...skipping 30 matching lines...) Expand all Loading... |
106 | 114 |
107 // Stores the dialog bounds. | 115 // Stores the dialog bounds. |
108 virtual void StoreDialogSize(const gfx::Size& dialog_size) {} | 116 virtual void StoreDialogSize(const gfx::Size& dialog_size) {} |
109 | 117 |
110 protected: | 118 protected: |
111 virtual ~WebDialogDelegate() {} | 119 virtual ~WebDialogDelegate() {} |
112 }; | 120 }; |
113 | 121 |
114 | 122 |
115 #endif // CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_DELEGATE_H_ | 123 #endif // CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_DELEGATE_H_ |
OLD | NEW |