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

Side by Side Diff: ash/system/brightness/tray_brightness.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: Modified CL to provide TrayItems and Tray*Views with parent pointers instead. 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
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/brightness/tray_brightness.h" 5 #include "ash/system/brightness/tray_brightness.h"
6 6
7 #include "ash/accelerators/accelerator_controller.h" 7 #include "ash/accelerators/accelerator_controller.h"
8 #include "ash/ash_constants.h" 8 #include "ash/ash_constants.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/system/brightness/brightness_control_delegate.h" 10 #include "ash/system/brightness/brightness_control_delegate.h"
11 #include "ash/system/tray/system_tray.h"
11 #include "ash/system/tray/system_tray_delegate.h" 12 #include "ash/system/tray/system_tray_delegate.h"
12 #include "ash/system/tray/tray_constants.h" 13 #include "ash/system/tray/tray_constants.h"
13 #include "ash/system/tray/tray_views.h" 14 #include "ash/system/tray/tray_views.h"
14 #include "base/bind.h" 15 #include "base/bind.h"
15 #include "base/message_loop.h" 16 #include "base/message_loop.h"
16 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
17 #include "grit/ash_resources.h" 18 #include "grit/ash_resources.h"
18 #include "grit/ash_strings.h" 19 #include "grit/ash_strings.h"
19 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 bool dragging_; 118 bool dragging_;
118 119
119 // Last brightness level that we observed, in the range [0.0, 100.0]. 120 // Last brightness level that we observed, in the range [0.0, 100.0].
120 double last_percent_; 121 double last_percent_;
121 122
122 DISALLOW_COPY_AND_ASSIGN(BrightnessView); 123 DISALLOW_COPY_AND_ASSIGN(BrightnessView);
123 }; 124 };
124 125
125 } // namespace tray 126 } // namespace tray
126 127
127 TrayBrightness::TrayBrightness() 128 TrayBrightness::TrayBrightness(SystemTray* system_tray)
128 : weak_ptr_factory_(this), 129 : SystemTrayItem(system_tray),
130 weak_ptr_factory_(this),
129 brightness_view_(NULL), 131 brightness_view_(NULL),
130 is_default_view_(false), 132 is_default_view_(false),
131 current_percent_(100.0), 133 current_percent_(100.0),
132 got_current_percent_(false) { 134 got_current_percent_(false) {
133 // Post a task to get the initial brightness; the BrightnessControlDelegate 135 // Post a task to get the initial brightness; the BrightnessControlDelegate
134 // isn't created yet. 136 // isn't created yet.
135 MessageLoopForUI::current()->PostTask( 137 MessageLoopForUI::current()->PostTask(
136 FROM_HERE, 138 FROM_HERE,
137 base::Bind(&TrayBrightness::GetInitialBrightness, 139 base::Bind(&TrayBrightness::GetInitialBrightness,
138 weak_ptr_factory_.GetWeakPtr())); 140 weak_ptr_factory_.GetWeakPtr()));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 return; 204 return;
203 205
204 if (brightness_view_) 206 if (brightness_view_)
205 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); 207 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds);
206 else 208 else
207 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); 209 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false);
208 } 210 }
209 211
210 } // namespace internal 212 } // namespace internal
211 } // namespace ash 213 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698