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