OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/maximize_mode/maximize_mode_controller.h" | 5 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 tablet_mode_switch_is_on_(false), | 111 tablet_mode_switch_is_on_(false), |
112 lid_is_closed_(false), | 112 lid_is_closed_(false), |
113 scoped_session_observer_(this), | 113 scoped_session_observer_(this), |
114 weak_factory_(this) { | 114 weak_factory_(this) { |
115 Shell::Get()->AddShellObserver(this); | 115 Shell::Get()->AddShellObserver(this); |
116 ShellPort::Get()->RecordUserMetricsAction( | 116 ShellPort::Get()->RecordUserMetricsAction( |
117 UMA_MAXIMIZE_MODE_INITIALLY_DISABLED); | 117 UMA_MAXIMIZE_MODE_INITIALLY_DISABLED); |
118 | 118 |
119 // TODO(jonross): Do not create MaximizeModeController if the flag is | 119 // TODO(jonross): Do not create MaximizeModeController if the flag is |
120 // unavailable. This will require refactoring | 120 // unavailable. This will require refactoring |
121 // IsMaximizeModeWindowManagerEnabled to check for the existance of the | 121 // IsMaximizeModeWindowManagerEnabled to check for the existence of the |
122 // controller. | 122 // controller. |
123 if (IsEnabled()) { | 123 if (IsEnabled()) { |
124 ShellPort::Get()->AddDisplayObserver(this); | 124 ShellPort::Get()->AddDisplayObserver(this); |
125 chromeos::AccelerometerReader::GetInstance()->AddObserver(this); | 125 chromeos::AccelerometerReader::GetInstance()->AddObserver(this); |
126 } | 126 } |
127 chromeos::PowerManagerClient* power_manager_client = | 127 chromeos::PowerManagerClient* power_manager_client = |
128 chromeos::DBusThreadManager::Get()->GetPowerManagerClient(); | 128 chromeos::DBusThreadManager::Get()->GetPowerManagerClient(); |
129 power_manager_client->AddObserver(this); | 129 power_manager_client->AddObserver(this); |
130 power_manager_client->GetSwitchStates(base::Bind( | 130 power_manager_client->GetSwitchStates(base::Bind( |
131 &MaximizeModeController::OnGetSwitchStates, weak_factory_.GetWeakPtr())); | 131 &MaximizeModeController::OnGetSwitchStates, weak_factory_.GetWeakPtr())); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 return elapsed_time.InSeconds() <= kLidRecentlyOpenedDurationSeconds; | 477 return elapsed_time.InSeconds() <= kLidRecentlyOpenedDurationSeconds; |
478 } | 478 } |
479 | 479 |
480 void MaximizeModeController::SetTickClockForTest( | 480 void MaximizeModeController::SetTickClockForTest( |
481 std::unique_ptr<base::TickClock> tick_clock) { | 481 std::unique_ptr<base::TickClock> tick_clock) { |
482 DCHECK(tick_clock_); | 482 DCHECK(tick_clock_); |
483 tick_clock_ = std::move(tick_clock); | 483 tick_clock_ = std::move(tick_clock); |
484 } | 484 } |
485 | 485 |
486 } // namespace ash | 486 } // namespace ash |
OLD | NEW |