| 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 #include "chrome/browser/ui/webui/web_dialog_ui.h" | 5 #include "ui/web_dialogs/web_dialog_ui.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/property_bag.h" | 10 #include "base/property_bag.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/ui/webui/web_dialog_delegate.h" | |
| 13 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
| 14 #include "content/public/browser/render_view_host.h" | 13 #include "content/public/browser/render_view_host.h" |
| 15 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/browser/web_ui.h" | 15 #include "content/public/browser/web_ui.h" |
| 17 #include "content/public/browser/web_ui_message_handler.h" | 16 #include "content/public/browser/web_ui_message_handler.h" |
| 18 #include "content/public/common/bindings_policy.h" | 17 #include "content/public/common/bindings_policy.h" |
| 18 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 19 | 19 |
| 20 using content::RenderViewHost; | 20 using content::RenderViewHost; |
| 21 using content::WebUIMessageHandler; | 21 using content::WebUIMessageHandler; |
| 22 | 22 |
| 23 static base::LazyInstance<base::PropertyAccessor<WebDialogDelegate*> > | 23 static base::LazyInstance<base::PropertyAccessor<ui::WebDialogDelegate*> > |
| 24 g_web_dialog_ui_property_accessor = LAZY_INSTANCE_INITIALIZER; | 24 g_web_dialog_ui_property_accessor = LAZY_INSTANCE_INITIALIZER; |
| 25 | 25 |
| 26 namespace ui { |
| 27 |
| 26 WebDialogUI::WebDialogUI(content::WebUI* web_ui) | 28 WebDialogUI::WebDialogUI(content::WebUI* web_ui) |
| 27 : WebUIController(web_ui) { | 29 : WebUIController(web_ui) { |
| 28 } | 30 } |
| 29 | 31 |
| 30 WebDialogUI::~WebDialogUI() { | 32 WebDialogUI::~WebDialogUI() { |
| 31 // Don't unregister our property. During the teardown of the WebContents, | 33 // Don't unregister our property. During the teardown of the WebContents, |
| 32 // this will be deleted, but the WebContents will already be destroyed. | 34 // this will be deleted, but the WebContents will already be destroyed. |
| 33 // | 35 // |
| 34 // This object is owned indirectly by the WebContents. WebUIs can change, so | 36 // This object is owned indirectly by the WebContents. WebUIs can change, so |
| 35 // it's scary if this WebUI is changed out and replaced with something else, | 37 // it's scary if this WebUI is changed out and replaced with something else, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // Non-file based UI needs to not have access to the Web UI bindings | 96 // Non-file based UI needs to not have access to the Web UI bindings |
| 95 // for security reasons. The code hosting the dialog should provide | 97 // for security reasons. The code hosting the dialog should provide |
| 96 // dialog specific functionality through other bindings and methods | 98 // dialog specific functionality through other bindings and methods |
| 97 // that are scoped in duration to the dialogs existence. | 99 // that are scoped in duration to the dialogs existence. |
| 98 web_ui->SetBindings(web_ui->GetBindings() & ~content::BINDINGS_POLICY_WEB_UI); | 100 web_ui->SetBindings(web_ui->GetBindings() & ~content::BINDINGS_POLICY_WEB_UI); |
| 99 } | 101 } |
| 100 | 102 |
| 101 ExternalWebDialogUI::~ExternalWebDialogUI() { | 103 ExternalWebDialogUI::~ExternalWebDialogUI() { |
| 102 } | 104 } |
| 103 | 105 |
| 104 std::string WebDialogDelegate::GetDialogName() const { | 106 } // namespace ui |
| 105 return std::string(); | |
| 106 } | |
| 107 | |
| 108 void WebDialogDelegate::GetMinimumDialogSize(gfx::Size* size) const { | |
| 109 GetDialogSize(size); | |
| 110 } | |
| 111 | |
| 112 bool WebDialogDelegate::HandleContextMenu( | |
| 113 const content::ContextMenuParams& params) { | |
| 114 return false; | |
| 115 } | |
| 116 | |
| 117 bool WebDialogDelegate::HandleOpenURLFromTab( | |
| 118 content::WebContents* source, | |
| 119 const content::OpenURLParams& params, | |
| 120 content::WebContents** out_new_contents) { | |
| 121 return false; | |
| 122 } | |
| 123 | |
| 124 bool WebDialogDelegate::HandleAddNewContents( | |
| 125 content::WebContents* source, | |
| 126 content::WebContents* new_contents, | |
| 127 WindowOpenDisposition disposition, | |
| 128 const gfx::Rect& initial_pos, | |
| 129 bool user_gesture) { | |
| 130 return false; | |
| 131 } | |
| OLD | NEW |