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

Side by Side Diff: chrome/browser/chromeos/notifications/balloon_view.cc

Issue 4635007: When an extension is uninstalled, close all desktop notifications from that e... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/chromeos/notifications/balloon_view.h" 5 #include "chrome/browser/chromeos/notifications/balloon_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/menus/simple_menu_model.h" 10 #include "app/menus/simple_menu_model.h"
11 #include "app/resource_bundle.h" 11 #include "app/resource_bundle.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/chromeos/notifications/balloon_view_host.h" 14 #include "chrome/browser/chromeos/notifications/balloon_view_host.h"
15 #include "chrome/browser/chromeos/notifications/notification_panel.h" 15 #include "chrome/browser/chromeos/notifications/notification_panel.h"
16 #include "chrome/browser/notifications/balloon.h" 16 #include "chrome/browser/notifications/balloon.h"
17 #include "chrome/browser/notifications/desktop_notification_service.h" 17 #include "chrome/browser/notifications/desktop_notification_service.h"
18 #include "chrome/browser/notifications/notification.h"
18 #include "chrome/browser/profile.h" 19 #include "chrome/browser/profile.h"
19 #include "chrome/browser/renderer_host/render_view_host.h" 20 #include "chrome/browser/renderer_host/render_view_host.h"
20 #include "chrome/browser/renderer_host/render_widget_host_view.h" 21 #include "chrome/browser/renderer_host/render_widget_host_view.h"
21 #include "chrome/browser/views/notifications/balloon_view_host.h" 22 #include "chrome/browser/views/notifications/balloon_view_host.h"
22 #include "chrome/common/notification_details.h" 23 #include "chrome/common/notification_details.h"
23 #include "chrome/common/notification_source.h" 24 #include "chrome/common/notification_source.h"
24 #include "chrome/common/notification_type.h" 25 #include "chrome/common/notification_type.h"
25 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
26 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
27 #include "views/background.h" 28 #include "views/background.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // (e.g., because of a crash), we want to close the balloon. 294 // (e.g., because of a crash), we want to close the balloon.
294 notification_registrar_.Remove(this, 295 notification_registrar_.Remove(this,
295 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); 296 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_));
296 Close(false); 297 Close(false);
297 } 298 }
298 299
299 //////////////////////////////////////////////////////////////////////////////// 300 ////////////////////////////////////////////////////////////////////////////////
300 // BalloonViewImpl public. 301 // BalloonViewImpl public.
301 302
302 bool BalloonViewImpl::IsFor(const Notification& notification) const { 303 bool BalloonViewImpl::IsFor(const Notification& notification) const {
303 return balloon_->notification().IsSame(notification); 304 return balloon_->notification().notification_id() ==
305 notification.notification_id();
304 } 306 }
305 307
306 void BalloonViewImpl::Activated() { 308 void BalloonViewImpl::Activated() {
307 if (!control_view_host_.get()) 309 if (!control_view_host_.get())
308 return; 310 return;
309 311
310 // Get the size of Control View. 312 // Get the size of Control View.
311 gfx::Size size = 313 gfx::Size size =
312 control_view_host_->GetRootView()->GetChildViewAt(0)->GetPreferredSize(); 314 control_view_host_->GetRootView()->GetChildViewAt(0)->GetPreferredSize();
313 control_view_host_->Show(); 315 control_view_host_->Show();
(...skipping 24 matching lines...) Expand all
338 service->DenyPermission(balloon_->notification().origin_url()); 340 service->DenyPermission(balloon_->notification().origin_url());
339 } 341 }
340 342
341 gfx::NativeView BalloonViewImpl::GetParentNativeView() { 343 gfx::NativeView BalloonViewImpl::GetParentNativeView() {
342 RenderWidgetHostView* view = html_contents_->render_view_host()->view(); 344 RenderWidgetHostView* view = html_contents_->render_view_host()->view();
343 DCHECK(view); 345 DCHECK(view);
344 return view->GetNativeView(); 346 return view->GetNativeView();
345 } 347 }
346 348
347 } // namespace chromeos 349 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698