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 #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_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
11 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" | 11 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" |
| 12 #include "chrome/common/chrome_notification_types.h" |
12 #include "chrome/common/extensions/extension_messages.h" | 13 #include "chrome/common/extensions/extension_messages.h" |
13 #include "chrome/common/render_messages.h" | 14 #include "chrome/common/render_messages.h" |
14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
15 #include "content/browser/renderer_host/browser_render_process_host.h" | 16 #include "content/browser/renderer_host/browser_render_process_host.h" |
16 #include "content/browser/renderer_host/render_view_host.h" | 17 #include "content/browser/renderer_host/render_view_host.h" |
17 #include "content/browser/site_instance.h" | 18 #include "content/browser/site_instance.h" |
18 #include "content/common/bindings_policy.h" | 19 #include "content/common/bindings_policy.h" |
19 #include "content/common/notification_service.h" | 20 #include "content/common/notification_service.h" |
20 #include "content/common/notification_source.h" | 21 #include "content/common/notification_source.h" |
21 #include "content/common/notification_type.h" | |
22 #include "content/common/renderer_preferences.h" | 22 #include "content/common/renderer_preferences.h" |
23 #include "content/common/view_messages.h" | 23 #include "content/common/view_messages.h" |
24 #include "ipc/ipc_message.h" | 24 #include "ipc/ipc_message.h" |
25 #include "webkit/glue/webpreferences.h" | 25 #include "webkit/glue/webpreferences.h" |
26 | 26 |
27 BalloonHost::BalloonHost(Balloon* balloon) | 27 BalloonHost::BalloonHost(Balloon* balloon) |
28 : render_view_host_(NULL), | 28 : render_view_host_(NULL), |
29 balloon_(balloon), | 29 balloon_(balloon), |
30 initialized_(false), | 30 initialized_(false), |
31 should_notify_on_disconnect_(false), | 31 should_notify_on_disconnect_(false), |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 render_view_host->routing_id(), balloon_->min_scrollbar_size())); | 93 render_view_host->routing_id(), balloon_->min_scrollbar_size())); |
94 render_view_host->WasResized(); | 94 render_view_host->WasResized(); |
95 render_view_host->Send(new ViewMsg_EnablePreferredSizeChangedMode( | 95 render_view_host->Send(new ViewMsg_EnablePreferredSizeChangedMode( |
96 render_view_host->routing_id(), | 96 render_view_host->routing_id(), |
97 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow)); | 97 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow)); |
98 } | 98 } |
99 | 99 |
100 void BalloonHost::RenderViewReady(RenderViewHost* render_view_host) { | 100 void BalloonHost::RenderViewReady(RenderViewHost* render_view_host) { |
101 should_notify_on_disconnect_ = true; | 101 should_notify_on_disconnect_ = true; |
102 NotificationService::current()->Notify( | 102 NotificationService::current()->Notify( |
103 NotificationType::NOTIFY_BALLOON_CONNECTED, | 103 chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, |
104 Source<BalloonHost>(this), NotificationService::NoDetails()); | 104 Source<BalloonHost>(this), NotificationService::NoDetails()); |
105 } | 105 } |
106 | 106 |
107 void BalloonHost::RenderViewGone(RenderViewHost* render_view_host, | 107 void BalloonHost::RenderViewGone(RenderViewHost* render_view_host, |
108 base::TerminationStatus status, | 108 base::TerminationStatus status, |
109 int error_code) { | 109 int error_code) { |
110 Close(render_view_host); | 110 Close(render_view_host); |
111 } | 111 } |
112 | 112 |
113 ViewType::Type BalloonHost::GetRenderViewType() const { | 113 ViewType::Type BalloonHost::GetRenderViewType() const { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 BalloonHost::~BalloonHost() { | 222 BalloonHost::~BalloonHost() { |
223 DCHECK(!render_view_host_); | 223 DCHECK(!render_view_host_); |
224 } | 224 } |
225 | 225 |
226 void BalloonHost::NotifyDisconnect() { | 226 void BalloonHost::NotifyDisconnect() { |
227 if (!should_notify_on_disconnect_) | 227 if (!should_notify_on_disconnect_) |
228 return; | 228 return; |
229 | 229 |
230 should_notify_on_disconnect_ = false; | 230 should_notify_on_disconnect_ = false; |
231 NotificationService::current()->Notify( | 231 NotificationService::current()->Notify( |
232 NotificationType::NOTIFY_BALLOON_DISCONNECTED, | 232 chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, |
233 Source<BalloonHost>(this), NotificationService::NoDetails()); | 233 Source<BalloonHost>(this), NotificationService::NoDetails()); |
234 } | 234 } |
235 | 235 |
236 bool BalloonHost::IsRenderViewReady() const { | 236 bool BalloonHost::IsRenderViewReady() const { |
237 return should_notify_on_disconnect_; | 237 return should_notify_on_disconnect_; |
238 } | 238 } |
OLD | NEW |