| 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 "ui/message_center/views/notification_view.h" | 5 #include "ui/message_center/views/notification_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 void NotificationView::ButtonPressed(views::Button* sender, | 369 void NotificationView::ButtonPressed(views::Button* sender, |
| 370 const ui::Event& event) { | 370 const ui::Event& event) { |
| 371 // Certain operations can cause |this| to be destructed, so copy the members | 371 // Certain operations can cause |this| to be destructed, so copy the members |
| 372 // we send to other parts of the code. | 372 // we send to other parts of the code. |
| 373 // TODO(dewittj): Remove this hack. | 373 // TODO(dewittj): Remove this hack. |
| 374 std::string id(notification_id()); | 374 std::string id(notification_id()); |
| 375 | 375 |
| 376 if (close_button_ && sender == close_button_.get()) { | 376 if (close_button_ && sender == close_button_.get()) { |
| 377 // Warning: This causes the NotificationView itself to be deleted, so don't | 377 // Warning: This causes the NotificationView itself to be deleted, so don't |
| 378 // do anything afterwards. | 378 // do anything afterwards. |
| 379 controller()->RemoveNotification(id, true /* by_user */); | 379 OnCloseButtonPressed(); |
| 380 return; | 380 return; |
| 381 } | 381 } |
| 382 | 382 |
| 383 if (sender == settings_button_view_) { | 383 if (sender == settings_button_view_) { |
| 384 controller()->ClickOnSettingsButton(id); | 384 controller()->ClickOnSettingsButton(id); |
| 385 return; | 385 return; |
| 386 } | 386 } |
| 387 | 387 |
| 388 // See if the button pressed was an action button. | 388 // See if the button pressed was an action button. |
| 389 for (size_t i = 0; i < action_buttons_.size(); ++i) { | 389 for (size_t i = 0; i < action_buttons_.size(); ++i) { |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 | 759 |
| 760 return message_line_limit; | 760 return message_line_limit; |
| 761 } | 761 } |
| 762 | 762 |
| 763 int NotificationView::GetMessageHeight(int width, int limit) const { | 763 int NotificationView::GetMessageHeight(int width, int limit) const { |
| 764 return message_view_ ? | 764 return message_view_ ? |
| 765 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; | 765 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; |
| 766 } | 766 } |
| 767 | 767 |
| 768 } // namespace message_center | 768 } // namespace message_center |
| OLD | NEW |