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

Side by Side Diff: chrome/browser/chromeos/power/brightness_observer.cc

Issue 10911261: chromeos: Stop calling ProfileManager::GetDefaultProfile() from extension event dispatch functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added function comments Created 8 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 | 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 "chrome/browser/chromeos/power/brightness_observer.h" 5 #include "chrome/browser/chromeos/power/brightness_observer.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/wm/power_button_controller.h" 8 #include "ash/wm/power_button_controller.h"
9 #include "chrome/browser/extensions/system/system_api.h" 9 #include "chrome/browser/extensions/system/system_api.h"
10 #include "chromeos/dbus/dbus_thread_manager.h" 10 #include "chromeos/dbus/dbus_thread_manager.h"
11 11
12 namespace chromeos { 12 namespace chromeos {
13 13
14 BrightnessObserver::BrightnessObserver() { 14 BrightnessObserver::BrightnessObserver(Profile* profile)
15 : profile_(profile) {
15 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); 16 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
16 } 17 }
17 18
18 BrightnessObserver::~BrightnessObserver() { 19 BrightnessObserver::~BrightnessObserver() {
19 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); 20 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
20 } 21 }
21 22
22 void BrightnessObserver::BrightnessChanged(int level, bool user_initiated) { 23 void BrightnessObserver::BrightnessChanged(int level, bool user_initiated) {
23 extensions::DispatchBrightnessChangedEvent(level, user_initiated); 24 extensions::DispatchBrightnessChangedEvent(profile_, level, user_initiated);
24 ash::Shell::GetInstance()->power_button_controller()-> 25 ash::Shell::GetInstance()->power_button_controller()->
25 OnScreenBrightnessChanged(static_cast<double>(level)); 26 OnScreenBrightnessChanged(static_cast<double>(level));
26 } 27 }
27 28
28 } // namespace chromeos 29 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698