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

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

Issue 8772035: Fix other notify of NOTIFICATION_HTML_DIALOG_SHOWN to pass the RenderViewHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | « no previous file | chrome/test/data/webui/certificate_viewer_dialog_test.js » ('j') | 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) 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/constrained_html_ui.h" 5 #include "chrome/browser/ui/webui/constrained_html_ui.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 // Add a "DialogClose" callback which matches HTMLDialogUI behavior. 47 // Add a "DialogClose" callback which matches HTMLDialogUI behavior.
48 RegisterMessageCallback("DialogClose", 48 RegisterMessageCallback("DialogClose",
49 base::Bind(&ConstrainedHtmlUI::OnDialogCloseMessage, 49 base::Bind(&ConstrainedHtmlUI::OnDialogCloseMessage,
50 base::Unretained(this))); 50 base::Unretained(this)));
51 51
52 content::NotificationService::current()->Notify( 52 content::NotificationService::current()->Notify(
53 chrome::NOTIFICATION_HTML_DIALOG_SHOWN, 53 chrome::NOTIFICATION_HTML_DIALOG_SHOWN,
54 content::Source<WebUI>(this), 54 content::Source<WebUI>(this),
55 content::NotificationService::NoDetails()); 55 content::Details<RenderViewHost>(render_view_host));
56 } 56 }
57 57
58 void ConstrainedHtmlUI::OnDialogCloseMessage(const ListValue* args) { 58 void ConstrainedHtmlUI::OnDialogCloseMessage(const ListValue* args) {
59 ConstrainedHtmlUIDelegate* delegate = GetConstrainedDelegate(); 59 ConstrainedHtmlUIDelegate* delegate = GetConstrainedDelegate();
60 if (!delegate) 60 if (!delegate)
61 return; 61 return;
62 62
63 std::string json_retval; 63 std::string json_retval;
64 if (!args->empty() && !args->GetString(0, &json_retval)) 64 if (!args->empty() && !args->GetString(0, &json_retval))
65 NOTREACHED() << "Could not read JSON argument"; 65 NOTREACHED() << "Could not read JSON argument";
66 delegate->GetHtmlDialogUIDelegate()->OnDialogClosed(json_retval); 66 delegate->GetHtmlDialogUIDelegate()->OnDialogClosed(json_retval);
67 delegate->OnDialogCloseFromWebUI(); 67 delegate->OnDialogCloseFromWebUI();
68 } 68 }
69 69
70 ConstrainedHtmlUIDelegate* ConstrainedHtmlUI::GetConstrainedDelegate() { 70 ConstrainedHtmlUIDelegate* ConstrainedHtmlUI::GetConstrainedDelegate() {
71 ConstrainedHtmlUIDelegate** property = 71 ConstrainedHtmlUIDelegate** property =
72 GetPropertyAccessor().GetProperty(tab_contents()->property_bag()); 72 GetPropertyAccessor().GetProperty(tab_contents()->property_bag());
73 return property ? *property : NULL; 73 return property ? *property : NULL;
74 } 74 }
75 75
76 // static 76 // static
77 base::PropertyAccessor<ConstrainedHtmlUIDelegate*>& 77 base::PropertyAccessor<ConstrainedHtmlUIDelegate*>&
78 ConstrainedHtmlUI::GetPropertyAccessor() { 78 ConstrainedHtmlUI::GetPropertyAccessor() {
79 return g_constrained_html_ui_property_accessor.Get(); 79 return g_constrained_html_ui_property_accessor.Get();
80 } 80 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/certificate_viewer_dialog_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698