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

Side by Side Diff: ash/wm/power_button_controller.cc

Issue 2319783002: mash: Allow a subset of D-Bus clients to be created in DBusThreadManager (Closed)
Patch Set: WIP, add DBusThreadManagerAsh and DBusThreadManagerChrome Created 4 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
« no previous file with comments | « ash/wm/lock_state_controller.cc ('k') | chrome/browser/chromeos/BUILD.gn » ('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/wm/power_button_controller.h" 5 #include "ash/wm/power_button_controller.h"
6 6
7 #include "ash/common/dbus_thread_manager_ash.h"
7 #include "ash/common/accelerators/accelerator_controller.h" 8 #include "ash/common/accelerators/accelerator_controller.h"
8 #include "ash/common/ash_switches.h" 9 #include "ash/common/ash_switches.h"
9 #include "ash/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/shell_window_ids.h" 11 #include "ash/common/shell_window_ids.h"
11 #include "ash/common/system/audio/tray_audio.h" 12 #include "ash/common/system/audio/tray_audio.h"
12 #include "ash/common/system/tray/system_tray.h" 13 #include "ash/common/system/tray/system_tray.h"
13 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 14 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
14 #include "ash/common/wm_shell.h" 15 #include "ash/common/wm_shell.h"
15 #include "ash/shell.h" 16 #include "ash/shell.h"
16 #include "ash/wm/lock_state_controller.h" 17 #include "ash/wm/lock_state_controller.h"
17 #include "ash/wm/session_state_animator.h" 18 #include "ash/wm/session_state_animator.h"
18 #include "base/command_line.h" 19 #include "base/command_line.h"
19 #include "ui/aura/window_event_dispatcher.h" 20 #include "ui/aura/window_event_dispatcher.h"
20 #include "ui/display/types/display_snapshot.h" 21 #include "ui/display/types/display_snapshot.h"
21 #include "ui/events/event_handler.h" 22 #include "ui/events/event_handler.h"
22 #include "ui/wm/core/compound_event_filter.h" 23 #include "ui/wm/core/compound_event_filter.h"
23 24
24 #if defined(OS_CHROMEOS) 25 #if defined(OS_CHROMEOS)
25 #include "chromeos/audio/cras_audio_handler.h" 26 #include "chromeos/audio/cras_audio_handler.h"
26 #include "chromeos/dbus/dbus_thread_manager.h" 27 // #include "chromeos/dbus/dbus_thread_manager.h"
27 #endif 28 #endif
28 29
29 namespace ash { 30 namespace ash {
30 31
31 PowerButtonController::PowerButtonController(LockStateController* controller) 32 PowerButtonController::PowerButtonController(LockStateController* controller)
32 : power_button_down_(false), 33 : power_button_down_(false),
33 lock_button_down_(false), 34 lock_button_down_(false),
34 volume_down_pressed_(false), 35 volume_down_pressed_(false),
35 #if defined(OS_CHROMEOS) 36 #if defined(OS_CHROMEOS)
36 volume_percent_before_screenshot_(0), 37 volume_percent_before_screenshot_(0),
37 #endif 38 #endif
38 brightness_is_zero_(false), 39 brightness_is_zero_(false),
39 internal_display_off_and_external_display_on_(false), 40 internal_display_off_and_external_display_on_(false),
40 has_legacy_power_button_( 41 has_legacy_power_button_(
41 base::CommandLine::ForCurrentProcess()->HasSwitch( 42 base::CommandLine::ForCurrentProcess()->HasSwitch(
42 switches::kAuraLegacyPowerButton)), 43 switches::kAuraLegacyPowerButton)),
43 #if defined(OS_CHROMEOS) 44 #if defined(OS_CHROMEOS)
44 enable_quick_lock_(base::CommandLine::ForCurrentProcess()->HasSwitch( 45 enable_quick_lock_(base::CommandLine::ForCurrentProcess()->HasSwitch(
45 switches::kAshEnableTouchView)), 46 switches::kAshEnableTouchView)),
46 #else 47 #else
47 enable_quick_lock_(false), 48 enable_quick_lock_(false),
48 #endif 49 #endif
49 controller_(controller) { 50 controller_(controller) {
50 #if defined(OS_CHROMEOS) 51 #if defined(OS_CHROMEOS)
51 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( 52 DBusThreadManagerAsh::Get()->GetPowerManagerClient()->AddObserver(
52 this); 53 this);
53 Shell::GetInstance()->display_configurator()->AddObserver(this); 54 Shell::GetInstance()->display_configurator()->AddObserver(this);
54 #endif 55 #endif
55 Shell::GetInstance()->PrependPreTargetHandler(this); 56 Shell::GetInstance()->PrependPreTargetHandler(this);
56 } 57 }
57 58
58 PowerButtonController::~PowerButtonController() { 59 PowerButtonController::~PowerButtonController() {
59 Shell::GetInstance()->RemovePreTargetHandler(this); 60 Shell::GetInstance()->RemovePreTargetHandler(this);
60 #if defined(OS_CHROMEOS) 61 #if defined(OS_CHROMEOS)
61 Shell::GetInstance()->display_configurator()->RemoveObserver(this); 62 Shell::GetInstance()->display_configurator()->RemoveObserver(this);
62 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver( 63 DBusThreadManagerAsh::Get()->GetPowerManagerClient()->RemoveObserver(
63 this); 64 this);
64 #endif 65 #endif
65 } 66 }
66 67
67 void PowerButtonController::OnScreenBrightnessChanged(double percent) { 68 void PowerButtonController::OnScreenBrightnessChanged(double percent) {
68 brightness_is_zero_ = percent <= 0.001; 69 brightness_is_zero_ = percent <= 0.001;
69 } 70 }
70 71
71 void PowerButtonController::OnPowerButtonEvent( 72 void PowerButtonController::OnPowerButtonEvent(
72 bool down, 73 bool down,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 202 }
202 203
203 void PowerButtonController::PowerButtonEventReceived( 204 void PowerButtonController::PowerButtonEventReceived(
204 bool down, 205 bool down,
205 const base::TimeTicks& timestamp) { 206 const base::TimeTicks& timestamp) {
206 OnPowerButtonEvent(down, timestamp); 207 OnPowerButtonEvent(down, timestamp);
207 } 208 }
208 #endif // defined(OS_CHROMEOS) 209 #endif // defined(OS_CHROMEOS)
209 210
210 } // namespace ash 211 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/lock_state_controller.cc ('k') | chrome/browser/chromeos/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698