| Index: ui/web_dialogs/web_dialog_ui.h
|
| diff --git a/ui/web_dialogs/web_dialog_ui.h b/ui/web_dialogs/web_dialog_ui.h
|
| index 562cbb45f3676fe777773bab02af96e08bb8019c..e6e29f4dbd27b5c3b63510bae0acb551b4ef122a 100644
|
| --- a/ui/web_dialogs/web_dialog_ui.h
|
| +++ b/ui/web_dialogs/web_dialog_ui.h
|
| @@ -16,12 +16,6 @@
|
| #include "ui/base/ui_base_types.h"
|
| #include "ui/web_dialogs/web_dialogs_export.h"
|
|
|
| -
|
| -namespace base {
|
| -class ListValue;
|
| -template<class T> class PropertyAccessor;
|
| -}
|
| -
|
| namespace content {
|
| class WebContents;
|
| class WebUIMessageHandler;
|
| @@ -42,10 +36,11 @@ class WebDialogDelegate;
|
| // just embed a RenderView in a dialog and be done with it.
|
| //
|
| // Before loading a URL corresponding to this WebUI, the caller should set its
|
| -// delegate as a property on the WebContents. This WebUI will pick it up from
|
| -// there and call it back. This is a bit of a hack to allow the dialog to pass
|
| -// its delegate to the Web UI without having nasty accessors on the WebContents.
|
| -// The correct design using RVH directly would avoid all of this.
|
| +// delegate as user data on the WebContents by calling SetDelegate(). This WebUI
|
| +// will pick it up from there and call it back. This is a bit of a hack to allow
|
| +// the dialog to pass its delegate to the Web UI without having nasty accessors
|
| +// on the WebContents. The correct design using RVH directly would avoid all of
|
| +// this.
|
| class WEB_DIALOGS_EXPORT WebDialogUI : public content::WebUIController {
|
| public:
|
| struct WebDialogParams {
|
| @@ -59,22 +54,26 @@ class WEB_DIALOGS_EXPORT WebDialogUI : public content::WebUIController {
|
| std::string json_input;
|
| };
|
|
|
| - // When created, the property should already be set on the WebContents.
|
| + // When created, the delegate should already be set as user data on the
|
| + // WebContents.
|
| explicit WebDialogUI(content::WebUI* web_ui);
|
| virtual ~WebDialogUI();
|
|
|
| // Close the dialog, passing the specified arguments to the close handler.
|
| void CloseDialog(const base::ListValue* args);
|
|
|
| - // Returns the PropertyBag accessor object used to write the delegate pointer
|
| - // into the WebContents (see class-level comment above).
|
| - static base::PropertyAccessor<WebDialogDelegate*>& GetPropertyAccessor();
|
| + // Sets the delegate on the WebContents.
|
| + static void SetDelegate(content::WebContents* web_contents,
|
| + WebDialogDelegate* delegate);
|
|
|
| private:
|
| // WebUIController
|
| virtual void RenderViewCreated(
|
| content::RenderViewHost* render_view_host) OVERRIDE;
|
|
|
| + // Gets the delegate for the WebContent set with SetDelegate.
|
| + static WebDialogDelegate* GetDelegate(content::WebContents* web_contents);
|
| +
|
| // JS message handler.
|
| void OnDialogClosed(const base::ListValue* args);
|
|
|
|
|