OLD | NEW |
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/notifications/balloon_host.h" | 5 #include "chrome/browser/notifications/balloon_host.h" |
6 | 6 |
7 #include "chrome/browser/browser_list.h" | 7 #include "chrome/browser/browser_list.h" |
8 #include "chrome/browser/extensions/extension_process_manager.h" | 8 #include "chrome/browser/extensions/extension_process_manager.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/notifications/balloon.h" | 10 #include "chrome/browser/notifications/balloon.h" |
10 #include "chrome/browser/notifications/notification.h" | 11 #include "chrome/browser/notifications/notification.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
12 #include "chrome/browser/renderer_preferences_util.h" | 14 #include "chrome/browser/renderer_preferences_util.h" |
13 #include "chrome/common/bindings_policy.h" | 15 #include "chrome/common/bindings_policy.h" |
14 #include "chrome/common/render_messages.h" | 16 #include "chrome/common/render_messages.h" |
15 #include "chrome/common/render_messages_params.h" | 17 #include "chrome/common/render_messages_params.h" |
16 #include "chrome/common/renderer_preferences.h" | 18 #include "chrome/common/renderer_preferences.h" |
17 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
18 #include "content/browser/renderer_host/render_view_host.h" | 20 #include "content/browser/renderer_host/render_view_host.h" |
19 #include "content/browser/site_instance.h" | 21 #include "content/browser/site_instance.h" |
20 #include "content/common/notification_service.h" | 22 #include "content/common/notification_service.h" |
21 #include "content/common/notification_source.h" | 23 #include "content/common/notification_source.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 RenderViewHost* rvh = new RenderViewHost( | 196 RenderViewHost* rvh = new RenderViewHost( |
195 site_instance_.get(), this, MSG_ROUTING_NONE, NULL); | 197 site_instance_.get(), this, MSG_ROUTING_NONE, NULL); |
196 if (GetProfile()->GetExtensionService()) { | 198 if (GetProfile()->GetExtensionService()) { |
197 extension_function_dispatcher_.reset( | 199 extension_function_dispatcher_.reset( |
198 ExtensionFunctionDispatcher::Create( | 200 ExtensionFunctionDispatcher::Create( |
199 rvh, this, balloon_->notification().content_url())); | 201 rvh, this, balloon_->notification().content_url())); |
200 } | 202 } |
201 if (extension_function_dispatcher_.get()) { | 203 if (extension_function_dispatcher_.get()) { |
202 rvh->AllowBindings(BindingsPolicy::EXTENSION); | 204 rvh->AllowBindings(BindingsPolicy::EXTENSION); |
203 rvh->set_is_extension_process(true); | 205 rvh->set_is_extension_process(true); |
| 206 const Extension* installed_app = |
| 207 GetProfile()->GetExtensionService()->GetInstalledApp( |
| 208 balloon_->notification().content_url()); |
| 209 static_cast<BrowserRenderProcessHost*>(rvh->process())->set_installed_app( |
| 210 installed_app); |
204 } else if (enable_web_ui_) { | 211 } else if (enable_web_ui_) { |
205 rvh->AllowBindings(BindingsPolicy::WEB_UI); | 212 rvh->AllowBindings(BindingsPolicy::WEB_UI); |
206 } | 213 } |
207 | 214 |
208 // Do platform-specific initialization. | 215 // Do platform-specific initialization. |
209 render_view_host_ = rvh; | 216 render_view_host_ = rvh; |
210 InitRenderWidgetHostView(); | 217 InitRenderWidgetHostView(); |
211 DCHECK(render_widget_host_view()); | 218 DCHECK(render_widget_host_view()); |
212 | 219 |
213 rvh->set_view(render_widget_host_view()); | 220 rvh->set_view(render_widget_host_view()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 260 |
254 void BalloonHost::NotifyDisconnect() { | 261 void BalloonHost::NotifyDisconnect() { |
255 if (!should_notify_on_disconnect_) | 262 if (!should_notify_on_disconnect_) |
256 return; | 263 return; |
257 | 264 |
258 should_notify_on_disconnect_ = false; | 265 should_notify_on_disconnect_ = false; |
259 NotificationService::current()->Notify( | 266 NotificationService::current()->Notify( |
260 NotificationType::NOTIFY_BALLOON_DISCONNECTED, | 267 NotificationType::NOTIFY_BALLOON_DISCONNECTED, |
261 Source<BalloonHost>(this), NotificationService::NoDetails()); | 268 Source<BalloonHost>(this), NotificationService::NoDetails()); |
262 } | 269 } |
OLD | NEW |