| 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 "ash/system/network/tray_sms.h" | 5 #include "ash/system/network/tray_sms.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
| 10 #include "ash/system/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 DISALLOW_COPY_AND_ASSIGN(SmsObserver); | 135 DISALLOW_COPY_AND_ASSIGN(SmsObserver); |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 #endif // OS_CHROMEOS | 138 #endif // OS_CHROMEOS |
| 139 | 139 |
| 140 class TraySms::SmsDefaultView : public TrayItemMore { | 140 class TraySms::SmsDefaultView : public TrayItemMore { |
| 141 public: | 141 public: |
| 142 explicit SmsDefaultView(TraySms* tray) | 142 explicit SmsDefaultView(TraySms* tray) |
| 143 : TrayItemMore(tray), | 143 : TrayItemMore(tray), |
| 144 tray_(tray) { | 144 tray_(tray) { |
| 145 SetImage(ResourceBundle::GetSharedInstance().GetBitmapNamed( | 145 SetImage(ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 146 IDR_AURA_UBER_TRAY_SMS)); | 146 IDR_AURA_UBER_TRAY_SMS)); |
| 147 Update(); | 147 Update(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 virtual ~SmsDefaultView() {} | 150 virtual ~SmsDefaultView() {} |
| 151 | 151 |
| 152 void Update() { | 152 void Update() { |
| 153 int message_count = | 153 int message_count = |
| 154 static_cast<int>(tray_->sms_observer()->messages().GetSize()); | 154 static_cast<int>(tray_->sms_observer()->messages().GetSize()); |
| 155 string16 label = l10n_util::GetStringFUTF16( | 155 string16 label = l10n_util::GetStringFUTF16( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 virtual void ButtonPressed(views::Button* sender, | 205 virtual void ButtonPressed(views::Button* sender, |
| 206 const views::Event& event) OVERRIDE { | 206 const views::Event& event) OVERRIDE { |
| 207 tray_->sms_observer()->RemoveMessage(index_); | 207 tray_->sms_observer()->RemoveMessage(index_); |
| 208 tray_->Update(false); | 208 tray_->Update(false); |
| 209 } | 209 } |
| 210 | 210 |
| 211 private: | 211 private: |
| 212 int LayoutDetailedView() { | 212 int LayoutDetailedView() { |
| 213 views::ImageButton* close_button = new views::ImageButton(this); | 213 views::ImageButton* close_button = new views::ImageButton(this); |
| 214 close_button->SetImage(views::CustomButton::BS_NORMAL, | 214 close_button->SetImage(views::CustomButton::BS_NORMAL, |
| 215 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 215 ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 216 IDR_AURA_WINDOW_CLOSE)); | 216 IDR_AURA_WINDOW_CLOSE)); |
| 217 | 217 |
| 218 int msg_width = kTrayPopupWidth - kNotificationCloseButtonWidth - | 218 int msg_width = kTrayPopupWidth - kNotificationCloseButtonWidth - |
| 219 kTrayPopupPaddingHorizontal * 2; | 219 kTrayPopupPaddingHorizontal * 2; |
| 220 | 220 |
| 221 views::GridLayout* layout = new views::GridLayout(this); | 221 views::GridLayout* layout = new views::GridLayout(this); |
| 222 SetLayoutManager(layout); | 222 SetLayoutManager(layout); |
| 223 | 223 |
| 224 views::ColumnSet* columns = layout->AddColumnSet(0); | 224 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 225 | 225 |
| 226 // Message | 226 // Message |
| (...skipping 17 matching lines...) Expand all Loading... |
| 244 layout->StartRow(0, 0); | 244 layout->StartRow(0, 0); |
| 245 layout->AddView(message_label_); | 245 layout->AddView(message_label_); |
| 246 | 246 |
| 247 layout->AddPaddingRow(0, kPaddingVertical); | 247 layout->AddPaddingRow(0, kPaddingVertical); |
| 248 | 248 |
| 249 return msg_width; | 249 return msg_width; |
| 250 } | 250 } |
| 251 | 251 |
| 252 int LayoutNotificationView() { | 252 int LayoutNotificationView() { |
| 253 icon_ = new views::ImageView; | 253 icon_ = new views::ImageView; |
| 254 icon_->SetImage(ResourceBundle::GetSharedInstance().GetBitmapNamed( | 254 icon_->SetImage(ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 255 IDR_AURA_UBER_TRAY_SMS)); | 255 IDR_AURA_UBER_TRAY_SMS)); |
| 256 | 256 |
| 257 int msg_width = kTrayPopupWidth - kNotificationCloseButtonWidth - | 257 int msg_width = kTrayPopupWidth - kNotificationCloseButtonWidth - |
| 258 kTrayPopupPaddingHorizontal - kSmsIconWidth; | 258 kTrayPopupPaddingHorizontal - kSmsIconWidth; |
| 259 | 259 |
| 260 views::GridLayout* layout = new views::GridLayout(this); | 260 views::GridLayout* layout = new views::GridLayout(this); |
| 261 SetLayoutManager(layout); | 261 SetLayoutManager(layout); |
| 262 | 262 |
| 263 views::ColumnSet* columns = layout->AddColumnSet(0); | 263 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 264 | 264 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 473 } |
| 474 if (detailed_) | 474 if (detailed_) |
| 475 detailed_->Update(); | 475 detailed_->Update(); |
| 476 else if (notify) | 476 else if (notify) |
| 477 ShowNotificationView(); | 477 ShowNotificationView(); |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 | 480 |
| 481 } // namespace internal | 481 } // namespace internal |
| 482 } // namespace ash | 482 } // namespace ash |
| OLD | NEW |