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

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

Issue 10332231: Remove chrome::NOTIFICATION_WEB_DIALOG_SHOWN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add web_dialog_observer.h to chrome_browser.gypi 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 | « chrome/browser/ui/webui/web_dialog_observer.h ('k') | chrome/chrome_browser.gypi » ('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/web_dialog_ui.h" 5 #include "chrome/browser/ui/webui/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/property_bag.h" 10 #include "base/property_bag.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/ui/webui/web_dialog_delegate.h" 12 #include "chrome/browser/ui/webui/web_dialog_delegate.h"
13 #include "chrome/common/chrome_notification_types.h"
14 #include "content/public/browser/notification_service.h" 13 #include "content/public/browser/notification_service.h"
15 #include "content/public/browser/render_view_host.h" 14 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
17 #include "content/public/browser/web_ui.h" 16 #include "content/public/browser/web_ui.h"
18 #include "content/public/browser/web_ui_message_handler.h" 17 #include "content/public/browser/web_ui_message_handler.h"
19 #include "content/public/common/bindings_policy.h" 18 #include "content/public/common/bindings_policy.h"
20 19
21 using content::RenderViewHost; 20 using content::RenderViewHost;
22 using content::WebUIMessageHandler; 21 using content::WebUIMessageHandler;
23 22
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 (*delegate)->GetWebUIMessageHandlers(&handlers); 66 (*delegate)->GetWebUIMessageHandlers(&handlers);
68 } 67 }
69 68
70 if (0 != (web_ui()->GetBindings() & content::BINDINGS_POLICY_WEB_UI)) 69 if (0 != (web_ui()->GetBindings() & content::BINDINGS_POLICY_WEB_UI))
71 render_view_host->SetWebUIProperty("dialogArguments", dialog_args); 70 render_view_host->SetWebUIProperty("dialogArguments", dialog_args);
72 for (std::vector<WebUIMessageHandler*>::iterator it = handlers.begin(); 71 for (std::vector<WebUIMessageHandler*>::iterator it = handlers.begin();
73 it != handlers.end(); ++it) { 72 it != handlers.end(); ++it) {
74 web_ui()->AddMessageHandler(*it); 73 web_ui()->AddMessageHandler(*it);
75 } 74 }
76 75
77 content::NotificationService::current()->Notify( 76 if (delegate)
78 chrome::NOTIFICATION_WEB_DIALOG_SHOWN, 77 (*delegate)->OnDialogShown(web_ui(), render_view_host);
79 content::Source<content::WebUI>(web_ui()),
80 content::Details<RenderViewHost>(render_view_host));
81 } 78 }
82 79
83 void WebDialogUI::OnDialogClosed(const ListValue* args) { 80 void WebDialogUI::OnDialogClosed(const ListValue* args) {
84 WebDialogDelegate** delegate = GetPropertyAccessor().GetProperty( 81 WebDialogDelegate** delegate = GetPropertyAccessor().GetProperty(
85 web_ui()->GetWebContents()->GetPropertyBag()); 82 web_ui()->GetWebContents()->GetPropertyBag());
86 if (delegate) { 83 if (delegate) {
87 std::string json_retval; 84 std::string json_retval;
88 if (args && !args->empty() && !args->GetString(0, &json_retval)) 85 if (args && !args->empty() && !args->GetString(0, &json_retval))
89 NOTREACHED() << "Could not read JSON argument"; 86 NOTREACHED() << "Could not read JSON argument";
90 87
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 122 }
126 123
127 bool WebDialogDelegate::HandleAddNewContents( 124 bool WebDialogDelegate::HandleAddNewContents(
128 content::WebContents* source, 125 content::WebContents* source,
129 content::WebContents* new_contents, 126 content::WebContents* new_contents,
130 WindowOpenDisposition disposition, 127 WindowOpenDisposition disposition,
131 const gfx::Rect& initial_pos, 128 const gfx::Rect& initial_pos,
132 bool user_gesture) { 129 bool user_gesture) {
133 return false; 130 return false;
134 } 131 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/web_dialog_observer.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698