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

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

Issue 10262027: Rename HTML_DIALOG to WEB_DIALOG. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | « no previous file | chrome/browser/ui/webui/web_dialog_ui.cc » ('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) 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/constrained_web_dialog_ui.h" 5 #include "chrome/browser/ui/webui/constrained_web_dialog_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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 it != handlers.end(); ++it) { 48 it != handlers.end(); ++it) {
49 web_ui()->AddMessageHandler(*it); 49 web_ui()->AddMessageHandler(*it);
50 } 50 }
51 51
52 // Add a "DialogClose" callback which matches HTMLDialogUI behavior. 52 // Add a "DialogClose" callback which matches HTMLDialogUI behavior.
53 web_ui()->RegisterMessageCallback("DialogClose", 53 web_ui()->RegisterMessageCallback("DialogClose",
54 base::Bind(&ConstrainedWebDialogUI::OnDialogCloseMessage, 54 base::Bind(&ConstrainedWebDialogUI::OnDialogCloseMessage,
55 base::Unretained(this))); 55 base::Unretained(this)));
56 56
57 content::NotificationService::current()->Notify( 57 content::NotificationService::current()->Notify(
58 chrome::NOTIFICATION_HTML_DIALOG_SHOWN, 58 chrome::NOTIFICATION_WEB_DIALOG_SHOWN,
59 content::Source<content::WebUI>(web_ui()), 59 content::Source<content::WebUI>(web_ui()),
60 content::Details<RenderViewHost>(render_view_host)); 60 content::Details<RenderViewHost>(render_view_host));
61 } 61 }
62 62
63 void ConstrainedWebDialogUI::OnDialogCloseMessage(const ListValue* args) { 63 void ConstrainedWebDialogUI::OnDialogCloseMessage(const ListValue* args) {
64 ConstrainedWebDialogDelegate* delegate = GetConstrainedDelegate(); 64 ConstrainedWebDialogDelegate* delegate = GetConstrainedDelegate();
65 if (!delegate) 65 if (!delegate)
66 return; 66 return;
67 67
68 std::string json_retval; 68 std::string json_retval;
69 if (!args->empty() && !args->GetString(0, &json_retval)) 69 if (!args->empty() && !args->GetString(0, &json_retval))
70 NOTREACHED() << "Could not read JSON argument"; 70 NOTREACHED() << "Could not read JSON argument";
71 delegate->GetWebDialogDelegate()->OnDialogClosed(json_retval); 71 delegate->GetWebDialogDelegate()->OnDialogClosed(json_retval);
72 delegate->OnDialogCloseFromWebUI(); 72 delegate->OnDialogCloseFromWebUI();
73 } 73 }
74 74
75 ConstrainedWebDialogDelegate* ConstrainedWebDialogUI::GetConstrainedDelegate() { 75 ConstrainedWebDialogDelegate* ConstrainedWebDialogUI::GetConstrainedDelegate() {
76 ConstrainedWebDialogDelegate** property = GetPropertyAccessor().GetProperty( 76 ConstrainedWebDialogDelegate** property = GetPropertyAccessor().GetProperty(
77 web_ui()->GetWebContents()->GetPropertyBag()); 77 web_ui()->GetWebContents()->GetPropertyBag());
78 return property ? *property : NULL; 78 return property ? *property : NULL;
79 } 79 }
80 80
81 // static 81 // static
82 base::PropertyAccessor<ConstrainedWebDialogDelegate*>& 82 base::PropertyAccessor<ConstrainedWebDialogDelegate*>&
83 ConstrainedWebDialogUI::GetPropertyAccessor() { 83 ConstrainedWebDialogUI::GetPropertyAccessor() {
84 return g_constrained_web_dialog_ui_property_accessor.Get(); 84 return g_constrained_web_dialog_ui_property_accessor.Get();
85 } 85 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/web_dialog_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698