| 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 20 matching lines...) Expand all Loading... |
| 31 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
| 32 #include "chromeos/network/network_sms_handler.h" | 32 #include "chromeos/network/network_sms_handler.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 // Min height of the list of messages in the popup. | 37 // Min height of the list of messages in the popup. |
| 38 const int kMessageListMinHeight = 200; | 38 const int kMessageListMinHeight = 200; |
| 39 // Top/bottom padding of the text items. | 39 // Top/bottom padding of the text items. |
| 40 const int kPaddingVertical = 10; | 40 const int kPaddingVertical = 10; |
| 41 const int kSmsIconWidth = 50; | |
| 42 | 41 |
| 43 } // namespace | 42 } // namespace |
| 44 | 43 |
| 45 namespace ash { | 44 namespace ash { |
| 46 namespace internal { | 45 namespace internal { |
| 47 | 46 |
| 48 class SmsObserverBase { | 47 class SmsObserverBase { |
| 49 public: | 48 public: |
| 50 explicit SmsObserverBase(TraySms* tray) : tray_(tray) {} | 49 explicit SmsObserverBase(TraySms* tray) : tray_(tray) {} |
| 51 virtual ~SmsObserverBase() {} | 50 virtual ~SmsObserverBase() {} |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 247 |
| 249 return msg_width; | 248 return msg_width; |
| 250 } | 249 } |
| 251 | 250 |
| 252 int LayoutNotificationView() { | 251 int LayoutNotificationView() { |
| 253 icon_ = new views::ImageView; | 252 icon_ = new views::ImageView; |
| 254 icon_->SetImage(ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 253 icon_->SetImage(ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 255 IDR_AURA_UBER_TRAY_SMS)); | 254 IDR_AURA_UBER_TRAY_SMS)); |
| 256 | 255 |
| 257 int msg_width = kTrayPopupWidth - kNotificationCloseButtonWidth - | 256 int msg_width = kTrayPopupWidth - kNotificationCloseButtonWidth - |
| 258 kTrayPopupPaddingHorizontal - kSmsIconWidth; | 257 kTrayPopupPaddingHorizontal - kNotificationIconWidth; |
| 259 | 258 |
| 260 views::GridLayout* layout = new views::GridLayout(this); | 259 views::GridLayout* layout = new views::GridLayout(this); |
| 261 SetLayoutManager(layout); | 260 SetLayoutManager(layout); |
| 262 | 261 |
| 263 views::ColumnSet* columns = layout->AddColumnSet(0); | 262 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 264 | 263 |
| 265 // Icon | 264 // Icon |
| 266 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, | 265 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, |
| 267 0 /* resize percent */, | 266 0 /* resize percent */, |
| 268 views::GridLayout::FIXED, kSmsIconWidth, kSmsIconWidth); | 267 views::GridLayout::FIXED, |
| 268 kNotificationIconWidth, kNotificationIconWidth); |
| 269 |
| 270 columns->AddPaddingColumn(0, kTrayPopupPaddingHorizontal/2); |
| 269 | 271 |
| 270 // Message | 272 // Message |
| 271 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, | 273 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, |
| 272 0 /* resize percent */, | 274 0 /* resize percent */, |
| 273 views::GridLayout::FIXED, msg_width, msg_width); | 275 views::GridLayout::FIXED, msg_width, msg_width); |
| 274 | 276 |
| 277 // Layout rows |
| 275 layout->AddPaddingRow(0, kPaddingVertical); | 278 layout->AddPaddingRow(0, kPaddingVertical); |
| 276 | 279 |
| 277 layout->StartRow(0, 0); | 280 layout->StartRow(0, 0); |
| 278 layout->AddView(icon_, 1, 2); // 2 rows for icon | 281 layout->AddView(icon_, 1, 2); // 2 rows for icon |
| 279 layout->AddView(number_label_); | 282 layout->AddView(number_label_); |
| 280 layout->StartRow(0, 0); | 283 layout->StartRow(0, 0); |
| 281 layout->SkipColumns(1); | 284 layout->SkipColumns(1); |
| 282 layout->AddView(message_label_); | 285 layout->AddView(message_label_); |
| 283 layout->StartRow(0, 0); | 286 layout->StartRow(0, 0); |
| 284 | 287 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 476 } |
| 474 if (detailed_) | 477 if (detailed_) |
| 475 detailed_->Update(); | 478 detailed_->Update(); |
| 476 else if (notify) | 479 else if (notify) |
| 477 ShowNotificationView(); | 480 ShowNotificationView(); |
| 478 } | 481 } |
| 479 } | 482 } |
| 480 | 483 |
| 481 } // namespace internal | 484 } // namespace internal |
| 482 } // namespace ash | 485 } // namespace ash |
| OLD | NEW |