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