OLD | NEW |
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/notifications/balloon_host.h" | 5 #include "chrome/browser/notifications/balloon_host.h" |
6 #include "chrome/browser/notifications/balloon.h" | 6 #include "chrome/browser/notifications/balloon.h" |
7 #include "chrome/browser/notifications/notification.h" | 7 #include "chrome/browser/notifications/notification.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/renderer_preferences_util.h" | 9 #include "chrome/browser/renderer_preferences_util.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_list.h" | 11 #include "chrome/browser/ui/browser_list.h" |
12 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" | 12 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" |
13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
14 #include "chrome/common/extensions/extension_messages.h" | 14 #include "chrome/common/extensions/extension_messages.h" |
15 #include "chrome/common/render_messages.h" | 15 #include "chrome/common/render_messages.h" |
16 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
17 #include "chrome/common/chrome_view_type.h" | 17 #include "chrome/common/chrome_view_type.h" |
18 #include "content/browser/renderer_host/render_view_host.h" | 18 #include "content/browser/renderer_host/render_view_host.h" |
19 #include "content/browser/site_instance.h" | |
20 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
21 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
22 #include "content/public/browser/notification_source.h" | 21 #include "content/public/browser/notification_source.h" |
23 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
| 23 #include "content/public/browser/site_instance.h" |
24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
25 #include "content/public/common/bindings_policy.h" | 25 #include "content/public/common/bindings_policy.h" |
26 #include "content/public/common/renderer_preferences.h" | 26 #include "content/public/common/renderer_preferences.h" |
27 #include "ipc/ipc_message.h" | 27 #include "ipc/ipc_message.h" |
28 #include "webkit/glue/webpreferences.h" | 28 #include "webkit/glue/webpreferences.h" |
29 | 29 |
| 30 using content::SiteInstance; |
30 using content::WebContents; | 31 using content::WebContents; |
31 | 32 |
32 BalloonHost::BalloonHost(Balloon* balloon) | 33 BalloonHost::BalloonHost(Balloon* balloon) |
33 : balloon_(balloon), | 34 : balloon_(balloon), |
34 initialized_(false), | 35 initialized_(false), |
35 should_notify_on_disconnect_(false), | 36 should_notify_on_disconnect_(false), |
36 enable_web_ui_(false), | 37 enable_web_ui_(false), |
37 ALLOW_THIS_IN_INITIALIZER_LIST( | 38 ALLOW_THIS_IN_INITIALIZER_LIST( |
38 extension_function_dispatcher_(balloon_->profile(), this)) { | 39 extension_function_dispatcher_(balloon_->profile(), this)) { |
39 site_instance_ = SiteInstance::CreateSiteInstanceForURL( | 40 site_instance_ = SiteInstance::CreateForURL( |
40 balloon_->profile(), balloon_->notification().content_url()); | 41 balloon_->profile(), balloon_->notification().content_url()); |
41 } | 42 } |
42 | 43 |
43 void BalloonHost::Shutdown() { | 44 void BalloonHost::Shutdown() { |
44 NotifyDisconnect(); | 45 NotifyDisconnect(); |
45 web_contents_.reset(); | 46 web_contents_.reset(); |
46 } | 47 } |
47 | 48 |
48 Browser* BalloonHost::GetBrowser() { | 49 Browser* BalloonHost::GetBrowser() { |
49 // Notifications aren't associated with a particular browser. | 50 // Notifications aren't associated with a particular browser. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 should_notify_on_disconnect_ = false; | 156 should_notify_on_disconnect_ = false; |
156 content::NotificationService::current()->Notify( | 157 content::NotificationService::current()->Notify( |
157 chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, | 158 chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, |
158 content::Source<BalloonHost>(this), | 159 content::Source<BalloonHost>(this), |
159 content::NotificationService::NoDetails()); | 160 content::NotificationService::NoDetails()); |
160 } | 161 } |
161 | 162 |
162 bool BalloonHost::IsRenderViewReady() const { | 163 bool BalloonHost::IsRenderViewReady() const { |
163 return should_notify_on_disconnect_; | 164 return should_notify_on_disconnect_; |
164 } | 165 } |
OLD | NEW |