Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(733)

Side by Side Diff: ui/web_dialogs/web_dialog_ui.h

Issue 10353007: Extract a minimal subset of WebDialogUI/WebDialogDelegate from src/chrome -> src/ui/web_dialogs Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_WEB_DIALOGS_WEB_DIALOG_UI_H_
6 #define UI_WEB_DIALOGS_WEB_DIALOG_UI_H_
7 #pragma once
8
9 #include <string>
10 #include <vector>
mazda 2012/05/04 05:01:38 Please remove unnecessary headers.
11
12 #include "base/compiler_specific.h"
13 #include "base/string16.h"
14 #include "content/public/browser/web_contents_delegate.h"
15 #include "content/public/browser/web_ui_controller.h"
16 #include "googleurl/src/gurl.h"
17 #include "ui/base/ui_base_types.h"
18 #include "ui/web_dialogs/web_dialogs_export.h"
19
20
21 namespace base {
22 class ListValue;
23 template<class T> class PropertyAccessor;
24 }
25
26 namespace content {
27 class WebContents;
28 class WebUIMessageHandler;
29 struct ContextMenuParams;
30 }
31
32 namespace gfx {
33 class Size;
34 }
35
36 namespace web_dialogs {
37
38 class WebDialogDelegate;
39
40 // Displays file URL contents inside a modal web dialog.
41 //
42 // This application really should not use WebContents + WebUI. It should instead
43 // just embed a RenderView in a dialog and be done with it.
44 //
45 // Before loading a URL corresponding to this WebUI, the caller should set its
46 // delegate as a property on the WebContents. This WebUI will pick it up from
47 // there and call it back. This is a bit of a hack to allow the dialog to pass
48 // its delegate to the Web UI without having nasty accessors on the WebContents.
49 // The correct design using RVH directly would avoid all of this.
50 class WEB_DIALOGS_EXPORT WebDialogUI : public content::WebUIController {
51 public:
52 struct WebDialogParams {
53 // The URL for the content that will be loaded in the dialog.
54 GURL url;
55 // Width of the dialog.
56 int width;
57 // Height of the dialog.
58 int height;
59 // The JSON input to pass to the dialog when showing it.
60 std::string json_input;
61 };
62
63 // When created, the property should already be set on the WebContents.
64 explicit WebDialogUI(content::WebUI* web_ui);
65 virtual ~WebDialogUI();
66
67 // Close the dialog, passing the specified arguments to the close handler.
68 void CloseDialog(const base::ListValue* args);
69
70 // Returns the PropertyBag accessor object used to write the delegate pointer
71 // into the WebContents (see class-level comment above).
72 static base::PropertyAccessor<WebDialogDelegate*>& GetPropertyAccessor();
73
74 private:
75 // WebUIController
76 virtual void RenderViewCreated(
77 content::RenderViewHost* render_view_host) OVERRIDE;
78
79 // JS message handler.
80 void OnDialogClosed(const base::ListValue* args);
81
82 DISALLOW_COPY_AND_ASSIGN(WebDialogUI);
83 };
84
85 } // namespace web_dialogs
86 #endif // UI_WEB_DIALOGS_WEB_DIALOG_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698