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

Side by Side Diff: ash/system/chromeos/brightness/tray_brightness.cc

Issue 497733002: Declaring the weak_ptr_factory in proper order. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Maintaining function in proper order Created 6 years, 3 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/brightness/tray_brightness.h" 5 #include "ash/system/chromeos/brightness/tray_brightness.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/accelerators/accelerator_controller.h" 9 #include "ash/accelerators/accelerator_controller.h"
10 #include "ash/ash_constants.h" 10 #include "ash/ash_constants.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 void BrightnessView::SliderDragEnded(views::Slider* slider) { 167 void BrightnessView::SliderDragEnded(views::Slider* slider) {
168 DCHECK_EQ(slider, slider_); 168 DCHECK_EQ(slider, slider_);
169 dragging_ = false; 169 dragging_ = false;
170 slider_->SetValue(static_cast<float>(last_percent_ / 100.0)); 170 slider_->SetValue(static_cast<float>(last_percent_ / 100.0));
171 } 171 }
172 172
173 } // namespace tray 173 } // namespace tray
174 174
175 TrayBrightness::TrayBrightness(SystemTray* system_tray) 175 TrayBrightness::TrayBrightness(SystemTray* system_tray)
176 : SystemTrayItem(system_tray), 176 : SystemTrayItem(system_tray),
177 weak_ptr_factory_(this),
178 brightness_view_(NULL), 177 brightness_view_(NULL),
179 current_percent_(100.0), 178 current_percent_(100.0),
180 got_current_percent_(false) { 179 got_current_percent_(false),
180 weak_ptr_factory_(this) {
181 // Post a task to get the initial brightness; the BrightnessControlDelegate 181 // Post a task to get the initial brightness; the BrightnessControlDelegate
182 // isn't created yet. 182 // isn't created yet.
183 base::MessageLoopForUI::current()->PostTask( 183 base::MessageLoopForUI::current()->PostTask(
184 FROM_HERE, 184 FROM_HERE,
185 base::Bind(&TrayBrightness::GetInitialBrightness, 185 base::Bind(&TrayBrightness::GetInitialBrightness,
186 weak_ptr_factory_.GetWeakPtr())); 186 weak_ptr_factory_.GetWeakPtr()));
187 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> 187 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
188 AddObserver(this); 188 AddObserver(this);
189 } 189 }
190 190
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 if (!Shell::GetInstance()->display_manager()->HasInternalDisplay()) 276 if (!Shell::GetInstance()->display_manager()->HasInternalDisplay())
277 return; 277 return;
278 278
279 if (brightness_view_) 279 if (brightness_view_)
280 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); 280 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds);
281 else 281 else
282 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); 282 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false);
283 } 283 }
284 284
285 } // namespace ash 285 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/brightness/tray_brightness.h ('k') | ash/wm/workspace/workspace_window_resizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698