| 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_UI_H_ | 5 #ifndef UI_WEB_DIALOGS_WEB_DIALOG_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_UI_H_ | 6 #define UI_WEB_DIALOGS_WEB_DIALOG_UI_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/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "content/public/browser/web_contents_delegate.h" | 14 #include "content/public/browser/web_contents_delegate.h" |
| 15 #include "content/public/browser/web_ui_controller.h" | 15 #include "content/public/browser/web_ui_controller.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 #include "ui/base/ui_base_types.h" | 17 #include "ui/base/ui_base_types.h" |
| 18 #include "ui/web_dialogs/web_dialogs_export.h" |
| 18 | 19 |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 class ListValue; | 22 class ListValue; |
| 22 template<class T> class PropertyAccessor; | 23 template<class T> class PropertyAccessor; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 class WebContents; | 27 class WebContents; |
| 27 class WebUIMessageHandler; | 28 class WebUIMessageHandler; |
| 28 struct ContextMenuParams; | 29 struct ContextMenuParams; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace gfx { | 32 namespace gfx { |
| 32 class Size; | 33 class Size; |
| 33 } | 34 } |
| 34 | 35 |
| 36 namespace ui { |
| 37 |
| 35 class WebDialogDelegate; | 38 class WebDialogDelegate; |
| 36 | 39 |
| 37 // Displays file URL contents inside a modal web dialog. | 40 // Displays file URL contents inside a modal web dialog. |
| 38 // | 41 // |
| 39 // This application really should not use WebContents + WebUI. It should instead | 42 // This application really should not use WebContents + WebUI. It should instead |
| 40 // just embed a RenderView in a dialog and be done with it. | 43 // just embed a RenderView in a dialog and be done with it. |
| 41 // | 44 // |
| 42 // Before loading a URL corresponding to this WebUI, the caller should set its | 45 // Before loading a URL corresponding to this WebUI, the caller should set its |
| 43 // delegate as a property on the WebContents. This WebUI will pick it up from | 46 // delegate as a property on the WebContents. This WebUI will pick it up from |
| 44 // there and call it back. This is a bit of a hack to allow the dialog to pass | 47 // there and call it back. This is a bit of a hack to allow the dialog to pass |
| 45 // its delegate to the Web UI without having nasty accessors on the WebContents. | 48 // its delegate to the Web UI without having nasty accessors on the WebContents. |
| 46 // The correct design using RVH directly would avoid all of this. | 49 // The correct design using RVH directly would avoid all of this. |
| 47 class WebDialogUI : public content::WebUIController { | 50 class WEB_DIALOGS_EXPORT WebDialogUI : public content::WebUIController { |
| 48 public: | 51 public: |
| 49 struct WebDialogParams { | 52 struct WebDialogParams { |
| 50 // The URL for the content that will be loaded in the dialog. | 53 // The URL for the content that will be loaded in the dialog. |
| 51 GURL url; | 54 GURL url; |
| 52 // Width of the dialog. | 55 // Width of the dialog. |
| 53 int width; | 56 int width; |
| 54 // Height of the dialog. | 57 // Height of the dialog. |
| 55 int height; | 58 int height; |
| 56 // The JSON input to pass to the dialog when showing it. | 59 // The JSON input to pass to the dialog when showing it. |
| 57 std::string json_input; | 60 std::string json_input; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 77 void OnDialogClosed(const base::ListValue* args); | 80 void OnDialogClosed(const base::ListValue* args); |
| 78 | 81 |
| 79 DISALLOW_COPY_AND_ASSIGN(WebDialogUI); | 82 DISALLOW_COPY_AND_ASSIGN(WebDialogUI); |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 // Displays external URL contents inside a modal web dialog. | 85 // Displays external URL contents inside a modal web dialog. |
| 83 // | 86 // |
| 84 // Intended to be the place to collect the settings and lockdowns | 87 // Intended to be the place to collect the settings and lockdowns |
| 85 // necessary for running external UI components securely (e.g., the | 88 // necessary for running external UI components securely (e.g., the |
| 86 // cloud print dialog). | 89 // cloud print dialog). |
| 87 class ExternalWebDialogUI : public WebDialogUI { | 90 class WEB_DIALOGS_EXPORT ExternalWebDialogUI : public WebDialogUI { |
| 88 public: | 91 public: |
| 89 explicit ExternalWebDialogUI(content::WebUI* web_ui); | 92 explicit ExternalWebDialogUI(content::WebUI* web_ui); |
| 90 virtual ~ExternalWebDialogUI(); | 93 virtual ~ExternalWebDialogUI(); |
| 91 }; | 94 }; |
| 92 | 95 |
| 93 #endif // CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_UI_H_ | 96 } // namespace ui |
| 97 |
| 98 #endif // UI_WEB_DIALOGS_WEB_DIALOG_UI_H_ |
| OLD | NEW |