| 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/chrome_notification_types.h" |
| 13 #include "chrome/common/extensions/extension_messages.h" | 13 #include "chrome/common/extensions/extension_messages.h" |
| 14 #include "chrome/common/render_messages.h" | 14 #include "chrome/common/render_messages.h" |
| 15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 16 #include "chrome/common/chrome_view_types.h" | 16 #include "chrome/common/chrome_view_types.h" |
| 17 #include "content/browser/renderer_host/browser_render_process_host.h" | 17 #include "content/browser/renderer_host/browser_render_process_host.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" | 19 #include "content/browser/site_instance.h" |
| 20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 21 #include "content/common/renderer_preferences.h" | |
| 22 #include "content/common/view_messages.h" | 21 #include "content/common/view_messages.h" |
| 23 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
| 24 #include "content/public/common/bindings_policy.h" | 23 #include "content/public/common/bindings_policy.h" |
| 24 #include "content/public/common/renderer_preferences.h" |
| 25 #include "ipc/ipc_message.h" | 25 #include "ipc/ipc_message.h" |
| 26 #include "webkit/glue/webpreferences.h" | 26 #include "webkit/glue/webpreferences.h" |
| 27 | 27 |
| 28 BalloonHost::BalloonHost(Balloon* balloon) | 28 BalloonHost::BalloonHost(Balloon* balloon) |
| 29 : render_view_host_(NULL), | 29 : render_view_host_(NULL), |
| 30 balloon_(balloon), | 30 balloon_(balloon), |
| 31 initialized_(false), | 31 initialized_(false), |
| 32 should_notify_on_disconnect_(false), | 32 should_notify_on_disconnect_(false), |
| 33 enable_web_ui_(false), | 33 enable_web_ui_(false), |
| 34 ALLOW_THIS_IN_INITIALIZER_LIST( | 34 ALLOW_THIS_IN_INITIALIZER_LIST( |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 | 159 |
| 160 void BalloonHost::UpdatePreferredSize(const gfx::Size& new_size) { | 160 void BalloonHost::UpdatePreferredSize(const gfx::Size& new_size) { |
| 161 balloon_->SetContentPreferredSize(new_size); | 161 balloon_->SetContentPreferredSize(new_size); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void BalloonHost::HandleMouseDown() { | 164 void BalloonHost::HandleMouseDown() { |
| 165 balloon_->OnClick(); | 165 balloon_->OnClick(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 RendererPreferences BalloonHost::GetRendererPrefs( | 168 content::RendererPreferences BalloonHost::GetRendererPrefs( |
| 169 content::BrowserContext* browser_context) const { | 169 content::BrowserContext* browser_context) const { |
| 170 Profile* profile = Profile::FromBrowserContext(browser_context); | 170 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 171 RendererPreferences preferences; | 171 content::RendererPreferences preferences; |
| 172 renderer_preferences_util::UpdateFromSystemSettings(&preferences, profile); | 172 renderer_preferences_util::UpdateFromSystemSettings(&preferences, profile); |
| 173 return preferences; | 173 return preferences; |
| 174 } | 174 } |
| 175 | 175 |
| 176 void BalloonHost::Init() { | 176 void BalloonHost::Init() { |
| 177 DCHECK(!render_view_host_) << "BalloonViewHost already initialized."; | 177 DCHECK(!render_view_host_) << "BalloonViewHost already initialized."; |
| 178 RenderViewHost* rvh = new RenderViewHost( | 178 RenderViewHost* rvh = new RenderViewHost( |
| 179 site_instance_.get(), this, MSG_ROUTING_NONE, NULL); | 179 site_instance_.get(), this, MSG_ROUTING_NONE, NULL); |
| 180 if (enable_web_ui_) | 180 if (enable_web_ui_) |
| 181 rvh->AllowBindings(content::BINDINGS_POLICY_WEB_UI); | 181 rvh->AllowBindings(content::BINDINGS_POLICY_WEB_UI); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 209 should_notify_on_disconnect_ = false; | 209 should_notify_on_disconnect_ = false; |
| 210 content::NotificationService::current()->Notify( | 210 content::NotificationService::current()->Notify( |
| 211 chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, | 211 chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, |
| 212 content::Source<BalloonHost>(this), | 212 content::Source<BalloonHost>(this), |
| 213 content::NotificationService::NoDetails()); | 213 content::NotificationService::NoDetails()); |
| 214 } | 214 } |
| 215 | 215 |
| 216 bool BalloonHost::IsRenderViewReady() const { | 216 bool BalloonHost::IsRenderViewReady() const { |
| 217 return should_notify_on_disconnect_; | 217 return should_notify_on_disconnect_; |
| 218 } | 218 } |
| OLD | NEW |