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/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
21 #include "content/common/view_messages.h" | |
22 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.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" |
25 #include "content/public/common/renderer_preferences.h" | 24 #include "content/public/common/renderer_preferences.h" |
26 #include "ipc/ipc_message.h" | 25 #include "ipc/ipc_message.h" |
27 #include "webkit/glue/webpreferences.h" | 26 #include "webkit/glue/webpreferences.h" |
28 | 27 |
29 BalloonHost::BalloonHost(Balloon* balloon) | 28 BalloonHost::BalloonHost(Balloon* balloon) |
30 : balloon_(balloon), | 29 : balloon_(balloon), |
31 initialized_(false), | 30 initialized_(false), |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 70 |
72 void BalloonHost::UpdatePreferredSize(TabContents* source, | 71 void BalloonHost::UpdatePreferredSize(TabContents* source, |
73 const gfx::Size& pref_size) { | 72 const gfx::Size& pref_size) { |
74 balloon_->SetContentPreferredSize(pref_size); | 73 balloon_->SetContentPreferredSize(pref_size); |
75 } | 74 } |
76 | 75 |
77 void BalloonHost::RenderViewCreated(RenderViewHost* render_view_host) { | 76 void BalloonHost::RenderViewCreated(RenderViewHost* render_view_host) { |
78 render_view_host->DisableScrollbarsForThreshold( | 77 render_view_host->DisableScrollbarsForThreshold( |
79 balloon_->min_scrollbar_size()); | 78 balloon_->min_scrollbar_size()); |
80 render_view_host->WasResized(); | 79 render_view_host->WasResized(); |
81 render_view_host->EnablePreferredSizeMode( | 80 render_view_host->EnablePreferredSizeMode(); |
82 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); | |
83 | 81 |
84 if (enable_web_ui_) | 82 if (enable_web_ui_) |
85 render_view_host->AllowBindings(content::BINDINGS_POLICY_WEB_UI); | 83 render_view_host->AllowBindings(content::BINDINGS_POLICY_WEB_UI); |
86 } | 84 } |
87 | 85 |
88 void BalloonHost::RenderViewReady() { | 86 void BalloonHost::RenderViewReady() { |
89 should_notify_on_disconnect_ = true; | 87 should_notify_on_disconnect_ = true; |
90 content::NotificationService::current()->Notify( | 88 content::NotificationService::current()->Notify( |
91 chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, | 89 chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, |
92 content::Source<BalloonHost>(this), | 90 content::Source<BalloonHost>(this), |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 should_notify_on_disconnect_ = false; | 144 should_notify_on_disconnect_ = false; |
147 content::NotificationService::current()->Notify( | 145 content::NotificationService::current()->Notify( |
148 chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, | 146 chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, |
149 content::Source<BalloonHost>(this), | 147 content::Source<BalloonHost>(this), |
150 content::NotificationService::NoDetails()); | 148 content::NotificationService::NoDetails()); |
151 } | 149 } |
152 | 150 |
153 bool BalloonHost::IsRenderViewReady() const { | 151 bool BalloonHost::IsRenderViewReady() const { |
154 return should_notify_on_disconnect_; | 152 return should_notify_on_disconnect_; |
155 } | 153 } |
OLD | NEW |