| OLD | NEW |
| 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 <algorithm> |
| 7 #include <vector> | 8 #include <vector> |
| 8 | 9 |
| 9 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 10 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/notifications/balloon.h" | 12 #include "chrome/browser/notifications/balloon.h" |
| 12 #include "chrome/browser/notifications/balloon_collection.h" | 13 #include "chrome/browser/notifications/balloon_collection.h" |
| 13 #include "chrome/browser/notifications/desktop_notification_service.h" | 14 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 14 #include "chrome/browser/notifications/notification.h" | 15 #include "chrome/browser/notifications/notification.h" |
| 15 #include "chrome/browser/notifications/notification_options_menu_model.h" | 16 #include "chrome/browser/notifications/notification_options_menu_model.h" |
| 16 #include "chrome/browser/ui/views/notifications/balloon_view_host.h" | 17 #include "chrome/browser/ui/views/notifications/balloon_view_host.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 279 |
| 279 balloon_ = balloon; | 280 balloon_ = balloon; |
| 280 | 281 |
| 281 SetBounds(balloon_->GetPosition().x(), balloon_->GetPosition().y(), | 282 SetBounds(balloon_->GetPosition().x(), balloon_->GetPosition().y(), |
| 282 GetTotalWidth(), GetTotalHeight()); | 283 GetTotalWidth(), GetTotalHeight()); |
| 283 | 284 |
| 284 const string16 source_label_text = l10n_util::GetStringFUTF16( | 285 const string16 source_label_text = l10n_util::GetStringFUTF16( |
| 285 IDS_NOTIFICATION_BALLOON_SOURCE_LABEL, | 286 IDS_NOTIFICATION_BALLOON_SOURCE_LABEL, |
| 286 balloon->notification().display_source()); | 287 balloon->notification().display_source()); |
| 287 | 288 |
| 288 source_label_ = new views::Label(UTF16ToWide(source_label_text)); | 289 source_label_ = new views::Label(source_label_text); |
| 289 AddChildView(source_label_); | 290 AddChildView(source_label_); |
| 290 options_menu_button_ = new views::MenuButton(NULL, L"", this, false); | 291 options_menu_button_ = new views::MenuButton(NULL, L"", this, false); |
| 291 AddChildView(options_menu_button_); | 292 AddChildView(options_menu_button_); |
| 292 close_button_ = new views::ImageButton(this); | 293 close_button_ = new views::ImageButton(this); |
| 293 close_button_->SetTooltipText(l10n_util::GetStringUTF16( | 294 close_button_->SetTooltipText(l10n_util::GetStringUTF16( |
| 294 IDS_NOTIFICATION_BALLOON_DISMISS_LABEL)); | 295 IDS_NOTIFICATION_BALLOON_DISMISS_LABEL)); |
| 295 AddChildView(close_button_); | 296 AddChildView(close_button_); |
| 296 | 297 |
| 297 // We have to create two windows: one for the contents and one for the | 298 // We have to create two windows: one for the contents and one for the |
| 298 // frame. Why? | 299 // frame. Why? |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 return; | 500 return; |
| 500 } | 501 } |
| 501 | 502 |
| 502 // If the renderer process attached to this balloon is disconnected | 503 // If the renderer process attached to this balloon is disconnected |
| 503 // (e.g., because of a crash), we want to close the balloon. | 504 // (e.g., because of a crash), we want to close the balloon. |
| 504 notification_registrar_.Remove( | 505 notification_registrar_.Remove( |
| 505 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, | 506 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, |
| 506 Source<Balloon>(balloon_)); | 507 Source<Balloon>(balloon_)); |
| 507 Close(false); | 508 Close(false); |
| 508 } | 509 } |
| OLD | NEW |