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 "ui/web_dialogs/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/values.h" | 10 #include "base/values.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 delegate->OnDialogShown(web_ui(), render_view_host); | 103 delegate->OnDialogShown(web_ui(), render_view_host); |
104 } | 104 } |
105 | 105 |
106 void WebDialogUI::OnDialogClosed(const ListValue* args) { | 106 void WebDialogUI::OnDialogClosed(const ListValue* args) { |
107 WebDialogDelegate* delegate = GetDelegate(web_ui()->GetWebContents()); | 107 WebDialogDelegate* delegate = GetDelegate(web_ui()->GetWebContents()); |
108 if (delegate) { | 108 if (delegate) { |
109 std::string json_retval; | 109 std::string json_retval; |
110 if (args && !args->empty() && !args->GetString(0, &json_retval)) | 110 if (args && !args->empty() && !args->GetString(0, &json_retval)) |
111 NOTREACHED() << "Could not read JSON argument"; | 111 NOTREACHED() << "Could not read JSON argument"; |
112 | 112 |
113 delegate->OnDialogClosed(json_retval); | 113 delegate->OnDialogCloseFromWebUI(json_retval); |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 ExternalWebDialogUI::ExternalWebDialogUI(content::WebUI* web_ui) | 117 ExternalWebDialogUI::ExternalWebDialogUI(content::WebUI* web_ui) |
118 : WebDialogUI(web_ui) { | 118 : WebDialogUI(web_ui) { |
119 // Non-file based UI needs to not have access to the Web UI bindings | 119 // Non-file based UI needs to not have access to the Web UI bindings |
120 // for security reasons. The code hosting the dialog should provide | 120 // for security reasons. The code hosting the dialog should provide |
121 // dialog specific functionality through other bindings and methods | 121 // dialog specific functionality through other bindings and methods |
122 // that are scoped in duration to the dialogs existence. | 122 // that are scoped in duration to the dialogs existence. |
123 web_ui->SetBindings(web_ui->GetBindings() & ~content::BINDINGS_POLICY_WEB_UI); | 123 web_ui->SetBindings(web_ui->GetBindings() & ~content::BINDINGS_POLICY_WEB_UI); |
124 } | 124 } |
125 | 125 |
126 ExternalWebDialogUI::~ExternalWebDialogUI() { | 126 ExternalWebDialogUI::~ExternalWebDialogUI() { |
127 } | 127 } |
128 | 128 |
129 } // namespace ui | 129 } // namespace ui |
OLD | NEW |