Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Side by Side Diff: ash/system/drive/tray_drive.cc

Issue 11415014: Stop using shell::GetInstance()->system_tray() in system tray items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix single-letter typo :(. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/system/drive/tray_drive.h ('k') | ash/system/ime/tray_ime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 ash::Shell::GetInstance()->tray_delegate(); 55 ash::Shell::GetInstance()->tray_delegate();
56 ash::DriveOperationStatusList* list = new ash::DriveOperationStatusList(); 56 ash::DriveOperationStatusList* list = new ash::DriveOperationStatusList();
57 delegate->GetDriveOperationStatusList(list); 57 delegate->GetDriveOperationStatusList(list);
58 return list; 58 return list;
59 } 59 }
60 60
61 } 61 }
62 62
63 namespace tray { 63 namespace tray {
64 64
65
66 class DriveDefaultView : public TrayItemMore { 65 class DriveDefaultView : public TrayItemMore {
67 public: 66 public:
68 DriveDefaultView(SystemTrayItem* owner, 67 DriveDefaultView(SystemTrayItem* owner,
69 const DriveOperationStatusList* list) 68 const DriveOperationStatusList* list)
70 : TrayItemMore(owner, true) { 69 : TrayItemMore(owner, true) {
71 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 70 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
72 71
73 SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_DRIVE).ToImageSkia()); 72 SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_DRIVE).ToImageSkia());
74 Update(list); 73 Update(list);
75 } 74 }
76 75
77 virtual ~DriveDefaultView() {} 76 virtual ~DriveDefaultView() {}
78 77
79 void Update(const DriveOperationStatusList* list) { 78 void Update(const DriveOperationStatusList* list) {
80 DCHECK(list); 79 DCHECK(list);
81 string16 label = GetTrayLabel(*list); 80 string16 label = GetTrayLabel(*list);
82 SetLabel(label); 81 SetLabel(label);
83 SetAccessibleName(label); 82 SetAccessibleName(label);
84 } 83 }
85 84
86 private: 85 private:
87 DISALLOW_COPY_AND_ASSIGN(DriveDefaultView); 86 DISALLOW_COPY_AND_ASSIGN(DriveDefaultView);
88 }; 87 };
89 88
90 class DriveDetailedView : public TrayDetailsView, 89 class DriveDetailedView : public TrayDetailsView,
91 public ViewClickListener { 90 public ViewClickListener {
92 public: 91 public:
93 DriveDetailedView(SystemTrayItem* owner, 92 DriveDetailedView(SystemTrayItem* owner,
94 const DriveOperationStatusList* list) 93 const DriveOperationStatusList* list)
95 : settings_(NULL), 94 : TrayDetailsView(owner),
95 settings_(NULL),
96 in_progress_img_(NULL), 96 in_progress_img_(NULL),
97 done_img_(NULL), 97 done_img_(NULL),
98 failed_img_(NULL) { 98 failed_img_(NULL) {
99 in_progress_img_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 99 in_progress_img_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
100 IDR_AURA_UBER_TRAY_DRIVE); 100 IDR_AURA_UBER_TRAY_DRIVE);
101 done_img_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 101 done_img_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
102 IDR_AURA_UBER_TRAY_DRIVE_DONE); 102 IDR_AURA_UBER_TRAY_DRIVE_DONE);
103 failed_img_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 103 failed_img_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
104 IDR_AURA_UBER_TRAY_DRIVE_FAILED); 104 IDR_AURA_UBER_TRAY_DRIVE_FAILED);
105 105
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 GetLocalizedString(IDS_ASH_STATUS_TRAY_DRIVE_SETTINGS), 349 GetLocalizedString(IDS_ASH_STATUS_TRAY_DRIVE_SETTINGS),
350 gfx::Font::NORMAL); 350 gfx::Font::NORMAL);
351 AddChildView(container); 351 AddChildView(container);
352 settings_ = container; 352 settings_ = container;
353 } 353 }
354 354
355 // Overridden from ViewClickListener. 355 // Overridden from ViewClickListener.
356 virtual void ClickedOn(views::View* sender) OVERRIDE { 356 virtual void ClickedOn(views::View* sender) OVERRIDE {
357 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); 357 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate();
358 if (sender == footer()->content()) { 358 if (sender == footer()->content()) {
359 Shell::GetInstance()->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING); 359 owner()->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
360 } else if (sender == settings_) { 360 } else if (sender == settings_) {
361 delegate->ShowDriveSettings(); 361 delegate->ShowDriveSettings();
362 } 362 }
363 } 363 }
364 364
365 // Maps operation entries to their file paths. 365 // Maps operation entries to their file paths.
366 std::map<FilePath, RowView*> update_map_; 366 std::map<FilePath, RowView*> update_map_;
367 views::View* settings_; 367 views::View* settings_;
368 gfx::ImageSkia* in_progress_img_; 368 gfx::ImageSkia* in_progress_img_;
369 gfx::ImageSkia* done_img_; 369 gfx::ImageSkia* done_img_;
370 gfx::ImageSkia* failed_img_; 370 gfx::ImageSkia* failed_img_;
371 371
372 DISALLOW_COPY_AND_ASSIGN(DriveDetailedView); 372 DISALLOW_COPY_AND_ASSIGN(DriveDetailedView);
373 }; 373 };
374 374
375 } // namespace tray 375 } // namespace tray
376 376
377 TrayDrive::TrayDrive() : 377 TrayDrive::TrayDrive(SystemTray* system_tray) :
378 TrayImageItem(IDR_AURA_UBER_TRAY_DRIVE_LIGHT), 378 TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_DRIVE_LIGHT),
379 default_(NULL), 379 default_(NULL),
380 detailed_(NULL) { 380 detailed_(NULL) {
381 } 381 }
382 382
383 TrayDrive::~TrayDrive() { 383 TrayDrive::~TrayDrive() {
384 } 384 }
385 385
386 bool TrayDrive::GetInitialVisibility() { 386 bool TrayDrive::GetInitialVisibility() {
387 scoped_ptr<DriveOperationStatusList> list(GetCurrentOperationList()); 387 scoped_ptr<DriveOperationStatusList> list(GetCurrentOperationList());
388 return list->size() > 0; 388 return list->size() > 0;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 if (default_) 440 if (default_)
441 default_->Update(&list); 441 default_->Update(&list);
442 442
443 if (detailed_) 443 if (detailed_)
444 detailed_->Update(&list); 444 detailed_->Update(&list);
445 } 445 }
446 446
447 } // namespace internal 447 } // namespace internal
448 } // namespace ash 448 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/drive/tray_drive.h ('k') | ash/system/ime/tray_ime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698