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

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

Issue 6330007: Don't use GetAsTabContents. Send notifications from TabContentsView instead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 6
7 #include "chrome/browser/browser_list.h" 7 #include "chrome/browser/browser_list.h"
8 #include "chrome/browser/extensions/extension_process_manager.h" 8 #include "chrome/browser/extensions/extension_process_manager.h"
9 #include "chrome/browser/notifications/balloon.h" 9 #include "chrome/browser/notifications/balloon.h"
10 #include "chrome/browser/notifications/notification.h" 10 #include "chrome/browser/notifications/notification.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/renderer_host/render_view_host.h" 12 #include "chrome/browser/renderer_host/render_view_host.h"
13 #include "chrome/browser/renderer_host/site_instance.h" 13 #include "chrome/browser/renderer_host/site_instance.h"
14 #include "chrome/browser/renderer_preferences_util.h" 14 #include "chrome/browser/renderer_preferences_util.h"
15 #include "chrome/common/bindings_policy.h" 15 #include "chrome/common/bindings_policy.h"
16 #include "chrome/common/notification_service.h" 16 #include "chrome/common/notification_service.h"
17 #include "chrome/common/notification_source.h" 17 #include "chrome/common/notification_source.h"
18 #include "chrome/common/notification_type.h" 18 #include "chrome/common/notification_type.h"
19 #include "chrome/common/render_messages.h" 19 #include "chrome/common/render_messages.h"
20 #include "chrome/common/render_messages_params.h"
20 #include "chrome/common/renderer_preferences.h" 21 #include "chrome/common/renderer_preferences.h"
21 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
22 #include "webkit/glue/webpreferences.h" 23 #include "webkit/glue/webpreferences.h"
23 24
24 BalloonHost::BalloonHost(Balloon* balloon) 25 BalloonHost::BalloonHost(Balloon* balloon)
25 : render_view_host_(NULL), 26 : render_view_host_(NULL),
26 balloon_(balloon), 27 balloon_(balloon),
27 initialized_(false), 28 initialized_(false),
28 should_notify_on_disconnect_(false), 29 should_notify_on_disconnect_(false),
29 enable_dom_ui_(false) { 30 enable_dom_ui_(false) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 const ViewHostMsg_DomMessage_Params& params) { 133 const ViewHostMsg_DomMessage_Params& params) {
133 if (extension_function_dispatcher_.get()) { 134 if (extension_function_dispatcher_.get()) {
134 extension_function_dispatcher_->HandleRequest(params); 135 extension_function_dispatcher_->HandleRequest(params);
135 } 136 }
136 } 137 }
137 138
138 // RenderViewHostDelegate::View methods implemented to allow links to 139 // RenderViewHostDelegate::View methods implemented to allow links to
139 // open pages in new tabs. 140 // open pages in new tabs.
140 void BalloonHost::CreateNewWindow( 141 void BalloonHost::CreateNewWindow(
141 int route_id, 142 int route_id,
142 WindowContainerType window_container_type, 143 const ViewHostMsg_CreateWindow_Params& params) {
143 const string16& frame_name) {
144 delegate_view_helper_.CreateNewWindow( 144 delegate_view_helper_.CreateNewWindow(
145 route_id, 145 route_id,
146 balloon_->profile(), 146 balloon_->profile(),
147 site_instance_.get(), 147 site_instance_.get(),
148 DOMUIFactory::GetDOMUIType(balloon_->profile(), 148 DOMUIFactory::GetDOMUIType(balloon_->profile(),
149 balloon_->notification().content_url()), 149 balloon_->notification().content_url()),
150 this, 150 this,
151 window_container_type, 151 params.window_container_type,
152 frame_name); 152 params.frame_name);
153 } 153 }
154 154
155 void BalloonHost::ShowCreatedWindow(int route_id, 155 void BalloonHost::ShowCreatedWindow(int route_id,
156 WindowOpenDisposition disposition, 156 WindowOpenDisposition disposition,
157 const gfx::Rect& initial_pos, 157 const gfx::Rect& initial_pos,
158 bool user_gesture) { 158 bool user_gesture) {
159 // Don't allow pop-ups from notifications. 159 // Don't allow pop-ups from notifications.
160 if (disposition == NEW_POPUP) 160 if (disposition == NEW_POPUP)
161 return; 161 return;
162 162
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 void BalloonHost::NotifyDisconnect() { 254 void BalloonHost::NotifyDisconnect() {
255 if (!should_notify_on_disconnect_) 255 if (!should_notify_on_disconnect_)
256 return; 256 return;
257 257
258 should_notify_on_disconnect_ = false; 258 should_notify_on_disconnect_ = false;
259 NotificationService::current()->Notify( 259 NotificationService::current()->Notify(
260 NotificationType::NOTIFY_BALLOON_DISCONNECTED, 260 NotificationType::NOTIFY_BALLOON_DISCONNECTED,
261 Source<BalloonHost>(this), NotificationService::NoDetails()); 261 Source<BalloonHost>(this), NotificationService::NoDetails());
262 } 262 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/balloon_host.h ('k') | chrome/browser/prerender/prerender_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698