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

Side by Side Diff: backlight.h

Issue 6715014: Display off is done by a callback into backlight controller (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/power_manager.git
Patch Set: Deleted unused lines, 2010->2011 Created 9 years, 9 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
« no previous file with comments | « no previous file | backlight.cc » ('j') | mock_backlight.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium OS 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 #ifndef POWER_MANAGER_BACKLIGHT_H_ 5 #ifndef POWER_MANAGER_BACKLIGHT_H_
6 #define POWER_MANAGER_BACKLIGHT_H_ 6 #define POWER_MANAGER_BACKLIGHT_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "power_manager/backlight_interface.h" 10 #include "power_manager/backlight_interface.h"
(...skipping 10 matching lines...) Expand all
21 // int64 level, max; 21 // int64 level, max;
22 // if (backlight.Init() && backlight.GetBrightness(&level, &max)) { 22 // if (backlight.Init() && backlight.GetBrightness(&level, &max)) {
23 // std::cout << "Current brightness level is " 23 // std::cout << "Current brightness level is "
24 // << level << " out of " << max << "\n"; 24 // << level << " out of " << max << "\n";
25 // } else { 25 // } else {
26 // std::cout << "Cannot get brightness level\n"; 26 // std::cout << "Cannot get brightness level\n";
27 // } 27 // }
28 28
29 class Backlight : public BacklightInterface { 29 class Backlight : public BacklightInterface {
30 public: 30 public:
31 Backlight() {} 31 Backlight();
32 virtual ~Backlight() {} 32 virtual ~Backlight() {}
33 33
34 // Initialize the backlight object. 34 // Initialize the backlight object.
35 // 35 //
36 // On success, return true; otherwise return false. 36 // On success, return true; otherwise return false.
37 bool Init(); 37 bool Init();
38 38
39 // Overridden from BacklightInterface: 39 // Overridden from BacklightInterface:
40 virtual bool GetBrightness(int64* level, int64* max); 40 virtual bool GetBrightness(int64* level, int64* max);
41 virtual bool GetTargetBrightness(int64* level); 41 virtual bool GetTargetBrightness(int64* level);
42 virtual bool SetBrightness(int64 level); 42 virtual bool SetBrightness(int64 level);
43 virtual void SetScreenOffFunc(SIGNAL_CALLBACK_PTR(void, func), void *data);
43 44
44 // Returns info about the gradual brightness transition, represented as the 45 // Returns info about the gradual brightness transition, represented as the
45 // number of steps and the interval of each step in milliseconds. 46 // number of steps and the interval of each step in milliseconds.
46 bool GetTransitionParams(int* num_steps, int* step_time_ms); 47 bool GetTransitionParams(int* num_steps, int* step_time_ms);
47 48
48 private: 49 private:
49 // Look for the existence of required files and return the granularity of 50 // Look for the existence of required files and return the granularity of
50 // the given backlight interface directory path. 51 // the given backlight interface directory path.
51 int64 CheckBacklightFiles(const FilePath& dir_path); 52 int64 CheckBacklightFiles(const FilePath& dir_path);
52 53
(...skipping 16 matching lines...) Expand all
69 SIGNAL_CALLBACK_2(Backlight, gboolean, SetBrightnessHard, int64, int64); 70 SIGNAL_CALLBACK_2(Backlight, gboolean, SetBrightnessHard, int64, int64);
70 71
71 // Paths to the actual_brightness, brightness, and max_brightness files 72 // Paths to the actual_brightness, brightness, and max_brightness files
72 // under /sys/class/backlight. 73 // under /sys/class/backlight.
73 FilePath actual_brightness_path_; 74 FilePath actual_brightness_path_;
74 FilePath brightness_path_; 75 FilePath brightness_path_;
75 FilePath max_brightness_path_; 76 FilePath max_brightness_path_;
76 77
77 int64 target_brightness_; // The current intended brightness level. 78 int64 target_brightness_; // The current intended brightness level.
78 79
80 // Callback function and data to determine whether to turn screen off.
81 void *turn_screen_off_data_;
82 SIGNAL_CALLBACK_PTR(void, turn_screen_off_func_);
83
79 DISALLOW_COPY_AND_ASSIGN(Backlight); 84 DISALLOW_COPY_AND_ASSIGN(Backlight);
80 }; 85 };
81 86
82 } // namespace power_manager 87 } // namespace power_manager
83 88
84 #endif // POWER_MANAGER_BACKLIGHT_H_ 89 #endif // POWER_MANAGER_BACKLIGHT_H_
OLDNEW
« no previous file with comments | « no previous file | backlight.cc » ('j') | mock_backlight.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698