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/drive/tray_drive.h" | 5 #include "ash/system/drive/tray_drive.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 namespace tray { | 62 namespace tray { |
63 | 63 |
64 | 64 |
65 class DriveDefaultView : public TrayItemMore { | 65 class DriveDefaultView : public TrayItemMore { |
66 public: | 66 public: |
67 DriveDefaultView(SystemTrayItem* owner, | 67 DriveDefaultView(SystemTrayItem* owner, |
68 const DriveOperationStatusList* list) | 68 const DriveOperationStatusList* list) |
69 : TrayItemMore(owner) { | 69 : TrayItemMore(owner) { |
70 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 70 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
71 | 71 |
72 SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_DRIVE).ToSkBitmap()); | 72 SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_DRIVE).ToImageSkia()); |
73 Update(list); | 73 Update(list); |
74 } | 74 } |
75 | 75 |
76 virtual ~DriveDefaultView() {} | 76 virtual ~DriveDefaultView() {} |
77 | 77 |
78 void Update(const DriveOperationStatusList* list) { | 78 void Update(const DriveOperationStatusList* list) { |
79 DCHECK(list); | 79 DCHECK(list); |
80 string16 label = GetTrayLabel(*list); | 80 string16 label = GetTrayLabel(*list); |
81 SetLabel(label); | 81 SetLabel(label); |
82 SetAccessibleName(label); | 82 SetAccessibleName(label); |
(...skipping 11 matching lines...) Expand all Loading... |
94 : header_(NULL), | 94 : header_(NULL), |
95 operations_(NULL), | 95 operations_(NULL), |
96 settings_(NULL), | 96 settings_(NULL), |
97 in_progress_img_(NULL), | 97 in_progress_img_(NULL), |
98 done_img_(NULL), | 98 done_img_(NULL), |
99 failed_img_(NULL) { | 99 failed_img_(NULL) { |
100 SetLayoutManager(new views::BoxLayout( | 100 SetLayoutManager(new views::BoxLayout( |
101 views::BoxLayout::kVertical, 0, 0, 0)); | 101 views::BoxLayout::kVertical, 0, 0, 0)); |
102 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); | 102 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); |
103 | 103 |
104 in_progress_img_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( | 104 in_progress_img_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
105 IDR_AURA_UBER_TRAY_DRIVE); | 105 IDR_AURA_UBER_TRAY_DRIVE); |
106 done_img_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( | 106 done_img_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
107 IDR_AURA_UBER_TRAY_DRIVE_DONE); | 107 IDR_AURA_UBER_TRAY_DRIVE_DONE); |
108 failed_img_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( | 108 failed_img_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
109 IDR_AURA_UBER_TRAY_DRIVE_FAILED); | 109 IDR_AURA_UBER_TRAY_DRIVE_FAILED); |
110 | 110 |
111 Update(list); | 111 Update(list); |
112 } | 112 } |
113 | 113 |
114 virtual ~DriveDetailedView() { | 114 virtual ~DriveDetailedView() { |
115 STLDeleteValues(&update_map_); | 115 STLDeleteValues(&update_map_); |
116 } | 116 } |
117 | 117 |
118 void Update(const DriveOperationStatusList* list) { | 118 void Update(const DriveOperationStatusList* list) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 171 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
172 label_container_->AddChildView(label); | 172 label_container_->AddChildView(label); |
173 // Add progress bar. | 173 // Add progress bar. |
174 progress_bar_ = new OperationProgressBar(); | 174 progress_bar_ = new OperationProgressBar(); |
175 label_container_->AddChildView(progress_bar_); | 175 label_container_->AddChildView(progress_bar_); |
176 | 176 |
177 AddChildView(label_container_); | 177 AddChildView(label_container_); |
178 | 178 |
179 cancel_button_ = new views::ImageButton(this); | 179 cancel_button_ = new views::ImageButton(this); |
180 cancel_button_->SetImage(views::ImageButton::BS_NORMAL, | 180 cancel_button_->SetImage(views::ImageButton::BS_NORMAL, |
181 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 181 ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
182 IDR_AURA_UBER_TRAY_DRIVE_CANCEL)); | 182 IDR_AURA_UBER_TRAY_DRIVE_CANCEL)); |
183 cancel_button_->SetImage(views::ImageButton::BS_HOT, | 183 cancel_button_->SetImage(views::ImageButton::BS_HOT, |
184 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 184 ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
185 IDR_AURA_UBER_TRAY_DRIVE_CANCEL_HOVER)); | 185 IDR_AURA_UBER_TRAY_DRIVE_CANCEL_HOVER)); |
186 | 186 |
187 UpdateStatus(state, progress); | 187 UpdateStatus(state, progress); |
188 AddChildView(cancel_button_); | 188 AddChildView(cancel_button_); |
189 } | 189 } |
190 | 190 |
191 void UpdateStatus(ash::DriveOperationStatus::OperationState state, | 191 void UpdateStatus(ash::DriveOperationStatus::OperationState state, |
192 double progress) { | 192 double progress) { |
193 status_img_->SetImage(container_->GetImageForState(state)); | 193 status_img_->SetImage(container_->GetImageForState(state)); |
194 progress_bar_->SetValue(progress); | 194 progress_bar_->SetValue(progress); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 }; | 266 }; |
267 | 267 |
268 void AppendHeaderEntry(const DriveOperationStatusList* list) { | 268 void AppendHeaderEntry(const DriveOperationStatusList* list) { |
269 if (header_) | 269 if (header_) |
270 return; | 270 return; |
271 header_ = new SpecialPopupRow(); | 271 header_ = new SpecialPopupRow(); |
272 header_->SetTextLabel(IDS_ASH_STATUS_TRAY_DRIVE, this); | 272 header_->SetTextLabel(IDS_ASH_STATUS_TRAY_DRIVE, this); |
273 AddChildView(header_); | 273 AddChildView(header_); |
274 } | 274 } |
275 | 275 |
276 SkBitmap* GetImageForState(ash::DriveOperationStatus::OperationState state) { | 276 gfx::ImageSkia* GetImageForState( |
| 277 ash::DriveOperationStatus::OperationState state) { |
277 switch (state) { | 278 switch (state) { |
278 case ash::DriveOperationStatus::OPERATION_NOT_STARTED: | 279 case ash::DriveOperationStatus::OPERATION_NOT_STARTED: |
279 case ash::DriveOperationStatus::OPERATION_STARTED: | 280 case ash::DriveOperationStatus::OPERATION_STARTED: |
280 case ash::DriveOperationStatus::OPERATION_IN_PROGRESS: | 281 case ash::DriveOperationStatus::OPERATION_IN_PROGRESS: |
281 case ash::DriveOperationStatus::OPERATION_SUSPENDED: | 282 case ash::DriveOperationStatus::OPERATION_SUSPENDED: |
282 return in_progress_img_; | 283 return in_progress_img_; |
283 case ash::DriveOperationStatus::OPERATION_COMPLETED: | 284 case ash::DriveOperationStatus::OPERATION_COMPLETED: |
284 return done_img_; | 285 return done_img_; |
285 case ash::DriveOperationStatus::OPERATION_FAILED: | 286 case ash::DriveOperationStatus::OPERATION_FAILED: |
286 return failed_img_; | 287 return failed_img_; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 } else if (sender == settings_) { | 369 } else if (sender == settings_) { |
369 delegate->ShowDriveSettings(); | 370 delegate->ShowDriveSettings(); |
370 } | 371 } |
371 } | 372 } |
372 | 373 |
373 // Maps operation entries to their file paths. | 374 // Maps operation entries to their file paths. |
374 std::map<FilePath, RowView*> update_map_; | 375 std::map<FilePath, RowView*> update_map_; |
375 SpecialPopupRow* header_; | 376 SpecialPopupRow* header_; |
376 views::View* operations_; | 377 views::View* operations_; |
377 views::View* settings_; | 378 views::View* settings_; |
378 SkBitmap* in_progress_img_; | 379 gfx::ImageSkia* in_progress_img_; |
379 SkBitmap* done_img_; | 380 gfx::ImageSkia* done_img_; |
380 SkBitmap* failed_img_; | 381 gfx::ImageSkia* failed_img_; |
381 | 382 |
382 DISALLOW_COPY_AND_ASSIGN(DriveDetailedView); | 383 DISALLOW_COPY_AND_ASSIGN(DriveDetailedView); |
383 }; | 384 }; |
384 | 385 |
385 } // namespace tray | 386 } // namespace tray |
386 | 387 |
387 TrayDrive::TrayDrive() : | 388 TrayDrive::TrayDrive() : |
388 TrayImageItem(IDR_AURA_UBER_TRAY_DRIVE_LIGHT), | 389 TrayImageItem(IDR_AURA_UBER_TRAY_DRIVE_LIGHT), |
389 default_(NULL), | 390 default_(NULL), |
390 detailed_(NULL) { | 391 detailed_(NULL) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 450 |
450 if (default_) | 451 if (default_) |
451 default_->Update(&list); | 452 default_->Update(&list); |
452 | 453 |
453 if (detailed_) | 454 if (detailed_) |
454 detailed_->Update(&list); | 455 detailed_->Update(&list); |
455 } | 456 } |
456 | 457 |
457 } // namespace internal | 458 } // namespace internal |
458 } // namespace ash | 459 } // namespace ash |
OLD | NEW |