Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: chrome/browser/notifications/balloon_host.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/common/notification_service.h" 20 #include "content/public/browser/notification_service.h"
21 #include "content/common/renderer_preferences.h" 21 #include "content/common/renderer_preferences.h"
22 #include "content/common/view_messages.h" 22 #include "content/common/view_messages.h"
23 #include "content/public/browser/notification_source.h" 23 #include "content/public/browser/notification_source.h"
24 #include "content/public/common/bindings_policy.h" 24 #include "content/public/common/bindings_policy.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),
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 void BalloonHost::RenderViewCreated(RenderViewHost* render_view_host) { 84 void BalloonHost::RenderViewCreated(RenderViewHost* render_view_host) {
85 render_view_host->DisableScrollbarsForThreshold( 85 render_view_host->DisableScrollbarsForThreshold(
86 balloon_->min_scrollbar_size()); 86 balloon_->min_scrollbar_size());
87 render_view_host->WasResized(); 87 render_view_host->WasResized();
88 render_view_host->EnablePreferredSizeMode( 88 render_view_host->EnablePreferredSizeMode(
89 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); 89 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow);
90 } 90 }
91 91
92 void BalloonHost::RenderViewReady(RenderViewHost* render_view_host) { 92 void BalloonHost::RenderViewReady(RenderViewHost* render_view_host) {
93 should_notify_on_disconnect_ = true; 93 should_notify_on_disconnect_ = true;
94 NotificationService::current()->Notify( 94 content::NotificationService::current()->Notify(
95 chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, 95 chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED,
96 content::Source<BalloonHost>(this), NotificationService::NoDetails()); 96 content::Source<BalloonHost>(this),
97 content::NotificationService::NoDetails());
97 } 98 }
98 99
99 void BalloonHost::RenderViewGone(RenderViewHost* render_view_host, 100 void BalloonHost::RenderViewGone(RenderViewHost* render_view_host,
100 base::TerminationStatus status, 101 base::TerminationStatus status,
101 int error_code) { 102 int error_code) {
102 Close(render_view_host); 103 Close(render_view_host);
103 } 104 }
104 105
105 content::ViewType BalloonHost::GetRenderViewType() const { 106 content::ViewType BalloonHost::GetRenderViewType() const {
106 return chrome::VIEW_TYPE_NOTIFICATION; 107 return chrome::VIEW_TYPE_NOTIFICATION;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 201
201 BalloonHost::~BalloonHost() { 202 BalloonHost::~BalloonHost() {
202 DCHECK(!render_view_host_); 203 DCHECK(!render_view_host_);
203 } 204 }
204 205
205 void BalloonHost::NotifyDisconnect() { 206 void BalloonHost::NotifyDisconnect() {
206 if (!should_notify_on_disconnect_) 207 if (!should_notify_on_disconnect_)
207 return; 208 return;
208 209
209 should_notify_on_disconnect_ = false; 210 should_notify_on_disconnect_ = false;
210 NotificationService::current()->Notify( 211 content::NotificationService::current()->Notify(
211 chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, 212 chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED,
212 content::Source<BalloonHost>(this), NotificationService::NoDetails()); 213 content::Source<BalloonHost>(this),
214 content::NotificationService::NoDetails());
213 } 215 }
214 216
215 bool BalloonHost::IsRenderViewReady() const { 217 bool BalloonHost::IsRenderViewReady() const {
216 return should_notify_on_disconnect_; 218 return should_notify_on_disconnect_;
217 } 219 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698