Chromium Code Reviews| 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/notification_view.h" | 5 #include "ui/message_center/notification_view.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
| 9 #include "ui/base/accessibility/accessible_view_state.h" | 9 #include "ui/base/accessibility/accessible_view_state.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 label->set_border(MakePadding( | 151 label->set_border(MakePadding( |
| 152 kActionButtonTitleTopPadding, kActionButtonTitleLeftPadding, | 152 kActionButtonTitleTopPadding, kActionButtonTitleLeftPadding, |
| 153 0, kActionButtonTitleRightPadding)); | 153 0, kActionButtonTitleRightPadding)); |
| 154 AddChildView(label); | 154 AddChildView(label); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace | 157 } // namespace |
| 158 | 158 |
| 159 namespace message_center { | 159 namespace message_center { |
| 160 | 160 |
| 161 // static | |
| 162 MessageView* NotificationView::ViewForNotification( | |
| 163 const NotificationList::Notification& notification, | |
| 164 NotificationList::Delegate* list_delegate) { | |
| 165 switch (notification.type) { | |
| 166 case ui::notifications::NOTIFICATION_TYPE_BASE_FORMAT: | |
| 167 case ui::notifications::NOTIFICATION_TYPE_IMAGE: | |
| 168 case ui::notifications::NOTIFICATION_TYPE_MULTIPLE: | |
| 169 case ui::notifications::NOTIFICATION_TYPE_SIMPLE: | |
| 170 break; | |
| 171 default: | |
| 172 // If the caller asks for an unrecognized kind of view (entirely possible | |
| 173 // if an application is running on an older version of this code that | |
| 174 // doesn't have the requested kind of notification template), we'll fall | |
| 175 // back to a notification instance that will provide at least basic | |
| 176 // functionality. | |
| 177 LOG(WARNING) << "Unable to fulfill request for unrecognized " | |
| 178 << "notification type " << notification.type << ". " | |
| 179 << "Falling back to simple notification type."; | |
| 180 } | |
|
miket_OOO
2013/01/22 22:39:18
Vertical whitespace after this line would make it
dharcourt
2013/01/23 08:10:12
Done.
| |
| 181 // Currently all roads lead to the generic NotificationView. | |
| 182 return new NotificationView(list_delegate, notification); | |
| 183 } | |
| 184 | |
| 161 NotificationView::NotificationView( | 185 NotificationView::NotificationView( |
| 162 NotificationList::Delegate* list_delegate, | 186 NotificationList::Delegate* list_delegate, |
| 163 const NotificationList::Notification& notification) | 187 const NotificationList::Notification& notification) |
| 164 : MessageView::MessageView(list_delegate, notification) { | 188 : MessageView::MessageView(list_delegate, notification) { |
| 165 } | 189 } |
| 166 | 190 |
| 167 NotificationView::~NotificationView() { | 191 NotificationView::~NotificationView() { |
| 168 } | 192 } |
| 169 | 193 |
| 170 void NotificationView::Layout() { | 194 void NotificationView::Layout() { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 action_buttons_.push_back(button); | 343 action_buttons_.push_back(button); |
| 320 layout->StartRow(0, 0); | 344 layout->StartRow(0, 0); |
| 321 layout->AddView(button, 2, 1, | 345 layout->AddView(button, 2, 1, |
| 322 views::GridLayout::FILL, views::GridLayout::FILL, 0, 40); | 346 views::GridLayout::FILL, views::GridLayout::FILL, 0, 40); |
| 323 } | 347 } |
| 324 | 348 |
| 325 return content_view_; | 349 return content_view_; |
| 326 } | 350 } |
| 327 | 351 |
| 328 } // namespace message_center | 352 } // namespace message_center |
| OLD | NEW |