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

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

Issue 12091075: Fix the issue introduced by hooking window.onbeforeunload in WebDialogView which breaks WebDialogUI… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « ui/web_dialogs/web_dialog_delegate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « ui/web_dialogs/web_dialog_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698