| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_views.h" | 5 #include "chrome/browser/ui/views/notifications/balloon_view_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 frame_container_(NULL), | 87 frame_container_(NULL), |
| 88 html_container_(NULL), | 88 html_container_(NULL), |
| 89 close_button_(NULL), | 89 close_button_(NULL), |
| 90 options_menu_button_(NULL), | 90 options_menu_button_(NULL), |
| 91 enable_web_ui_(false), | 91 enable_web_ui_(false), |
| 92 closed_by_user_(false), | 92 closed_by_user_(false), |
| 93 closed_(false) { | 93 closed_(false) { |
| 94 // We're owned by Balloon and don't want to be deleted by our parent View. | 94 // We're owned by Balloon and don't want to be deleted by our parent View. |
| 95 set_owned_by_client(); | 95 set_owned_by_client(); |
| 96 | 96 |
| 97 set_border(new views::BubbleBorder(views::BubbleBorder::FLOAT, | 97 SetBorder(scoped_ptr<views::Border>( |
| 98 views::BubbleBorder::NO_SHADOW, SK_ColorWHITE)); | 98 new views::BubbleBorder(views::BubbleBorder::FLOAT, |
| 99 views::BubbleBorder::NO_SHADOW, |
| 100 SK_ColorWHITE))); |
| 99 } | 101 } |
| 100 | 102 |
| 101 BalloonViewImpl::~BalloonViewImpl() { | 103 BalloonViewImpl::~BalloonViewImpl() { |
| 102 } | 104 } |
| 103 | 105 |
| 104 void BalloonViewImpl::Close(bool by_user) { | 106 void BalloonViewImpl::Close(bool by_user) { |
| 105 if (closed_) | 107 if (closed_) |
| 106 return; | 108 return; |
| 107 | 109 |
| 108 closed_ = true; | 110 closed_ = true; |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 close_button_->SetBackground(SK_ColorBLACK, | 361 close_button_->SetBackground(SK_ColorBLACK, |
| 360 rb.GetImageSkiaNamed(IDR_CLOSE_1), | 362 rb.GetImageSkiaNamed(IDR_CLOSE_1), |
| 361 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); | 363 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); |
| 362 | 364 |
| 363 options_menu_button_->SetIcon(*rb.GetImageSkiaNamed(IDR_BALLOON_WRENCH)); | 365 options_menu_button_->SetIcon(*rb.GetImageSkiaNamed(IDR_BALLOON_WRENCH)); |
| 364 options_menu_button_->SetHoverIcon( | 366 options_menu_button_->SetHoverIcon( |
| 365 *rb.GetImageSkiaNamed(IDR_BALLOON_WRENCH_H)); | 367 *rb.GetImageSkiaNamed(IDR_BALLOON_WRENCH_H)); |
| 366 options_menu_button_->SetPushedIcon(*rb.GetImageSkiaNamed( | 368 options_menu_button_->SetPushedIcon(*rb.GetImageSkiaNamed( |
| 367 IDR_BALLOON_WRENCH_P)); | 369 IDR_BALLOON_WRENCH_P)); |
| 368 options_menu_button_->set_alignment(views::TextButton::ALIGN_CENTER); | 370 options_menu_button_->set_alignment(views::TextButton::ALIGN_CENTER); |
| 369 options_menu_button_->set_border(NULL); | 371 options_menu_button_->SetBorder(views::Border::NullBorder()); |
| 370 options_menu_button_->SetBoundsRect(GetOptionsButtonBounds()); | 372 options_menu_button_->SetBoundsRect(GetOptionsButtonBounds()); |
| 371 | 373 |
| 372 source_label_->SetFontList(rb.GetFontList(ui::ResourceBundle::SmallFont)); | 374 source_label_->SetFontList(rb.GetFontList(ui::ResourceBundle::SmallFont)); |
| 373 source_label_->SetBackgroundColor(kControlBarBackgroundColor); | 375 source_label_->SetBackgroundColor(kControlBarBackgroundColor); |
| 374 source_label_->SetEnabledColor(kControlBarTextColor); | 376 source_label_->SetEnabledColor(kControlBarTextColor); |
| 375 source_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 377 source_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 376 source_label_->SetBoundsRect(GetLabelBounds()); | 378 source_label_->SetBoundsRect(GetLabelBounds()); |
| 377 | 379 |
| 378 SizeContentsWindow(); | 380 SizeContentsWindow(); |
| 379 html_container_->Show(); | 381 html_container_->Show(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 return; | 522 return; |
| 521 } | 523 } |
| 522 | 524 |
| 523 // If the renderer process attached to this balloon is disconnected | 525 // If the renderer process attached to this balloon is disconnected |
| 524 // (e.g., because of a crash), we want to close the balloon. | 526 // (e.g., because of a crash), we want to close the balloon. |
| 525 notification_registrar_.Remove( | 527 notification_registrar_.Remove( |
| 526 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, | 528 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, |
| 527 content::Source<Balloon>(balloon_)); | 529 content::Source<Balloon>(balloon_)); |
| 528 Close(false); | 530 Close(false); |
| 529 } | 531 } |
| OLD | NEW |