Chromium Code Reviews| 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 UI_WEB_DIALOGS_WEB_DIALOG_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_DELEGATE_H_ | 6 #define UI_WEB_DIALOGS_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 "ui/web_dialogs/web_dialogs_export.h" | |
| 14 #include "webkit/glue/window_open_disposition.h" | 15 #include "webkit/glue/window_open_disposition.h" |
| 15 | 16 |
| 16 class GURL; | 17 class GURL; |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 class RenderViewHost; | 20 class RenderViewHost; |
| 20 class WebContents; | 21 class WebContents; |
| 21 class WebUI; | 22 class WebUI; |
| 22 class WebUIMessageHandler; | 23 class WebUIMessageHandler; |
| 23 struct ContextMenuParams; | 24 struct ContextMenuParams; |
| 24 struct OpenURLParams; | 25 struct OpenURLParams; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace gfx { | 28 namespace gfx { |
| 28 class Rect; | 29 class Rect; |
| 29 class Size; | 30 class Size; |
| 30 } | 31 } |
| 31 | 32 |
| 33 namespace ui { | |
| 34 | |
| 32 // Implement this class to receive notifications. | 35 // Implement this class to receive notifications. |
| 33 class WebDialogDelegate { | 36 class WEB_DIALOGS_EXPORT WebDialogDelegate { |
|
tfarina
2012/05/30 19:14:19
nit: I bet you can remove WEB_DIALOGS_EXPORT. But
mazda
2012/05/30 20:14:12
It's necessary for HandleContextMenu, HandleOpenUR
| |
| 34 public: | 37 public: |
| 35 // Returns true if the contents needs to be run in a modal dialog. | 38 // Returns true if the contents needs to be run in a modal dialog. |
| 36 virtual ui::ModalType GetDialogModalType() const = 0; | 39 virtual ModalType GetDialogModalType() const = 0; |
| 37 | 40 |
| 38 // Returns the title of the dialog. | 41 // Returns the title of the dialog. |
| 39 virtual string16 GetDialogTitle() const = 0; | 42 virtual string16 GetDialogTitle() const = 0; |
| 40 | 43 |
| 41 // Returns the dialog's name identifier. Used to identify this dialog for | 44 // Returns the dialog's name identifier. Used to identify this dialog for |
| 42 // state restoration. | 45 // state restoration. |
| 43 virtual std::string GetDialogName() const; | 46 virtual std::string GetDialogName() const; |
| 44 | 47 |
| 45 // Get the HTML file path for the content to load in the dialog. | 48 // Get the HTML file path for the content to load in the dialog. |
| 46 virtual GURL GetDialogContentURL() const = 0; | 49 virtual GURL GetDialogContentURL() const = 0; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 bool* out_close_dialog) = 0; | 88 bool* out_close_dialog) = 0; |
| 86 | 89 |
| 87 // A callback to allow the delegate to dictate that the window should not | 90 // A callback to allow the delegate to dictate that the window should not |
| 88 // have a title bar. This is useful when presenting branded interfaces. | 91 // have a title bar. This is useful when presenting branded interfaces. |
| 89 virtual bool ShouldShowDialogTitle() const = 0; | 92 virtual bool ShouldShowDialogTitle() const = 0; |
| 90 | 93 |
| 91 // A callback to allow the delegate to inhibit context menu or show | 94 // A callback to allow the delegate to inhibit context menu or show |
| 92 // customized menu. | 95 // customized menu. |
| 93 // Returns true iff you do NOT want the standard context menu to be | 96 // Returns true iff you do NOT want the standard context menu to be |
| 94 // shown (because you want to handle it yourself). | 97 // shown (because you want to handle it yourself). |
| 95 virtual bool HandleContextMenu(const content::ContextMenuParams& params); | 98 virtual bool HandleContextMenu(const content::ContextMenuParams& params); |
|
tfarina
2012/05/30 19:14:19
This doesn't have any implementations. Can you add
mazda
2012/05/30 20:14:12
The implementations were left in web_dialog_ui.cc
| |
| 96 | 99 |
| 97 // A callback to allow the delegate to open a new URL inside |source|. | 100 // A callback to allow the delegate to open a new URL inside |source|. |
| 98 // On return |out_new_contents| should contain the WebContents the URL | 101 // On return |out_new_contents| should contain the WebContents the URL |
| 99 // is opened in. Return false to use the default handler. | 102 // is opened in. Return false to use the default handler. |
| 100 virtual bool HandleOpenURLFromTab(content::WebContents* source, | 103 virtual bool HandleOpenURLFromTab(content::WebContents* source, |
| 101 const content::OpenURLParams& params, | 104 const content::OpenURLParams& params, |
| 102 content::WebContents** out_new_contents); | 105 content::WebContents** out_new_contents); |
| 103 | 106 |
| 104 // A callback to create a new tab with |new_contents|. |source| is the | 107 // A callback to create a new tab with |new_contents|. |source| is the |
| 105 // WebContent where the operation originated. |disposition| controls how the | 108 // WebContent where the operation originated. |disposition| controls how the |
| 106 // new tab should be opened. |initial_pos| is the position of the window if a | 109 // new tab should be opened. |initial_pos| is the position of the window if a |
| 107 // new window is created. |user_gesture| is true if the operation was started | 110 // new window is created. |user_gesture| is true if the operation was started |
| 108 // by a user gesture. Return false to use the default handler. | 111 // by a user gesture. Return false to use the default handler. |
| 109 virtual bool HandleAddNewContents(content::WebContents* source, | 112 virtual bool HandleAddNewContents(content::WebContents* source, |
| 110 content::WebContents* new_contents, | 113 content::WebContents* new_contents, |
| 111 WindowOpenDisposition disposition, | 114 WindowOpenDisposition disposition, |
| 112 const gfx::Rect& initial_pos, | 115 const gfx::Rect& initial_pos, |
| 113 bool user_gesture); | 116 bool user_gesture); |
| 114 | 117 |
| 115 // Stores the dialog bounds. | 118 // Stores the dialog bounds. |
| 116 virtual void StoreDialogSize(const gfx::Size& dialog_size) {} | 119 virtual void StoreDialogSize(const gfx::Size& dialog_size) {} |
| 117 | 120 |
| 118 protected: | 121 protected: |
| 119 virtual ~WebDialogDelegate() {} | 122 virtual ~WebDialogDelegate() {} |
| 120 }; | 123 }; |
| 121 | 124 |
| 125 } // namespace ui | |
| 122 | 126 |
| 123 #endif // CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_DELEGATE_H_ | 127 #endif // UI_WEB_DIALOGS_WEB_DIALOG_DELEGATE_H_ |
| OLD | NEW |