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

Side by Side Diff: chrome/browser/ui/webui/html_dialog_ui.cc

Issue 8586009: Allow WebUI Tests to use preLoad in HtmlDialogUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert to patch set 4. Created 9 years, 1 month 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/html_dialog_ui.h" 5 #include "chrome/browser/ui/webui/html_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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 render_view_host->SetWebUIProperty("dialogArguments", dialog_args); 64 render_view_host->SetWebUIProperty("dialogArguments", dialog_args);
65 for (std::vector<WebUIMessageHandler*>::iterator it = handlers.begin(); 65 for (std::vector<WebUIMessageHandler*>::iterator it = handlers.begin();
66 it != handlers.end(); ++it) { 66 it != handlers.end(); ++it) {
67 (*it)->Attach(this); 67 (*it)->Attach(this);
68 AddMessageHandler(*it); 68 AddMessageHandler(*it);
69 } 69 }
70 70
71 content::NotificationService::current()->Notify( 71 content::NotificationService::current()->Notify(
72 chrome::NOTIFICATION_HTML_DIALOG_SHOWN, 72 chrome::NOTIFICATION_HTML_DIALOG_SHOWN,
73 content::Source<WebUI>(this), 73 content::Source<WebUI>(this),
74 content::NotificationService::NoDetails()); 74 content::Details<RenderViewHost>(render_view_host));
75 } 75 }
76 76
77 void HtmlDialogUI::OnDialogClosed(const ListValue* args) { 77 void HtmlDialogUI::OnDialogClosed(const ListValue* args) {
78 HtmlDialogUIDelegate** delegate = GetPropertyAccessor().GetProperty( 78 HtmlDialogUIDelegate** delegate = GetPropertyAccessor().GetProperty(
79 tab_contents()->property_bag()); 79 tab_contents()->property_bag());
80 if (delegate) { 80 if (delegate) {
81 std::string json_retval; 81 std::string json_retval;
82 if (args && !args->empty() && !args->GetString(0, &json_retval)) 82 if (args && !args->empty() && !args->GetString(0, &json_retval))
83 NOTREACHED() << "Could not read JSON argument"; 83 NOTREACHED() << "Could not read JSON argument";
84 84
85 (*delegate)->OnDialogClosed(json_retval); 85 (*delegate)->OnDialogClosed(json_retval);
86 } 86 }
87 } 87 }
88 88
89 ExternalHtmlDialogUI::ExternalHtmlDialogUI(TabContents* tab_contents) 89 ExternalHtmlDialogUI::ExternalHtmlDialogUI(TabContents* tab_contents)
90 : HtmlDialogUI(tab_contents) { 90 : HtmlDialogUI(tab_contents) {
91 // Non-file based UI needs to not have access to the Web UI bindings 91 // Non-file based UI needs to not have access to the Web UI bindings
92 // for security reasons. The code hosting the dialog should provide 92 // for security reasons. The code hosting the dialog should provide
93 // dialog specific functionality through other bindings and methods 93 // dialog specific functionality through other bindings and methods
94 // that are scoped in duration to the dialogs existence. 94 // that are scoped in duration to the dialogs existence.
95 bindings_ &= ~content::BINDINGS_POLICY_WEB_UI; 95 bindings_ &= ~content::BINDINGS_POLICY_WEB_UI;
96 } 96 }
97 97
98 ExternalHtmlDialogUI::~ExternalHtmlDialogUI() { 98 ExternalHtmlDialogUI::~ExternalHtmlDialogUI() {
99 } 99 }
100 100
101 bool HtmlDialogUIDelegate::HandleContextMenu(const ContextMenuParams& params) { 101 bool HtmlDialogUIDelegate::HandleContextMenu(const ContextMenuParams& params) {
102 return false; 102 return false;
103 } 103 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698