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

Side by Side Diff: chrome/browser/ui/views/notifications/balloon_view.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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/ui/views/notifications/balloon_view.h" 5 #include "chrome/browser/ui/views/notifications/balloon_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/notifications/balloon.h" 11 #include "chrome/browser/notifications/balloon.h"
12 #include "chrome/browser/notifications/balloon_collection.h" 12 #include "chrome/browser/notifications/balloon_collection.h"
13 #include "chrome/browser/notifications/desktop_notification_service.h" 13 #include "chrome/browser/notifications/desktop_notification_service.h"
14 #include "chrome/browser/notifications/notification.h" 14 #include "chrome/browser/notifications/notification.h"
15 #include "chrome/browser/notifications/notification_options_menu_model.h" 15 #include "chrome/browser/notifications/notification_options_menu_model.h"
16 #include "chrome/browser/ui/views/bubble/bubble_border.h" 16 #include "chrome/browser/ui/views/bubble/bubble_border.h"
17 #include "chrome/browser/ui/views/notifications/balloon_view_host.h" 17 #include "chrome/browser/ui/views/notifications/balloon_view_host.h"
18 #include "chrome/common/chrome_notification_types.h"
18 #include "content/browser/renderer_host/render_view_host.h" 19 #include "content/browser/renderer_host/render_view_host.h"
19 #include "content/browser/renderer_host/render_widget_host_view.h" 20 #include "content/browser/renderer_host/render_widget_host_view.h"
20 #include "content/common/notification_details.h" 21 #include "content/common/notification_details.h"
21 #include "content/common/notification_source.h" 22 #include "content/common/notification_source.h"
22 #include "content/common/notification_type.h" 23 #include "content/common/notification_type.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
24 #include "grit/theme_resources.h" 25 #include "grit/theme_resources.h"
25 #include "grit/theme_resources_standard.h" 26 #include "grit/theme_resources_standard.h"
26 #include "ui/base/animation/slide_animation.h" 27 #include "ui/base/animation/slide_animation.h"
27 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 source_label_->SetFont(rb.GetFont(ResourceBundle::SmallFont)); 352 source_label_->SetFont(rb.GetFont(ResourceBundle::SmallFont));
352 source_label_->SetColor(kControlBarTextColor); 353 source_label_->SetColor(kControlBarTextColor);
353 source_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 354 source_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
354 source_label_->SetBoundsRect(GetLabelBounds()); 355 source_label_->SetBoundsRect(GetLabelBounds());
355 356
356 SizeContentsWindow(); 357 SizeContentsWindow();
357 html_container_->Show(); 358 html_container_->Show();
358 frame_container_->Show(); 359 frame_container_->Show();
359 360
360 notification_registrar_.Add(this, 361 notification_registrar_.Add(this,
361 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon)); 362 chrome::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon));
362 } 363 }
363 364
364 void BalloonViewImpl::RunOptionsMenu(const gfx::Point& pt) { 365 void BalloonViewImpl::RunOptionsMenu(const gfx::Point& pt) {
365 CreateOptionsMenu(); 366 CreateOptionsMenu();
366 options_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT); 367 options_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT);
367 } 368 }
368 369
369 void BalloonViewImpl::CreateOptionsMenu() { 370 void BalloonViewImpl::CreateOptionsMenu() {
370 if (options_menu_model_.get()) 371 if (options_menu_model_.get())
371 return; 372 return;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 OnPaintBorder(canvas); 485 OnPaintBorder(canvas);
485 } 486 }
486 487
487 void BalloonViewImpl::OnBoundsChanged(const gfx::Rect& previous_bounds) { 488 void BalloonViewImpl::OnBoundsChanged(const gfx::Rect& previous_bounds) {
488 SizeContentsWindow(); 489 SizeContentsWindow();
489 } 490 }
490 491
491 void BalloonViewImpl::Observe(NotificationType type, 492 void BalloonViewImpl::Observe(NotificationType type,
492 const NotificationSource& source, 493 const NotificationSource& source,
493 const NotificationDetails& details) { 494 const NotificationDetails& details) {
494 if (type != NotificationType::NOTIFY_BALLOON_DISCONNECTED) { 495 if (type != chrome::NOTIFY_BALLOON_DISCONNECTED) {
495 NOTREACHED(); 496 NOTREACHED();
496 return; 497 return;
497 } 498 }
498 499
499 // If the renderer process attached to this balloon is disconnected 500 // If the renderer process attached to this balloon is disconnected
500 // (e.g., because of a crash), we want to close the balloon. 501 // (e.g., because of a crash), we want to close the balloon.
501 notification_registrar_.Remove(this, 502 notification_registrar_.Remove(this,
502 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); 503 chrome::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_));
503 Close(false); 504 Close(false);
504 } 505 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698