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 "apps/shell/browser/shell_desktop_controller.h" | 5 #include "apps/shell/browser/shell_desktop_controller.h" |
6 | 6 |
7 #include "apps/shell/browser/shell_app_window_controller.h" | 7 #include "apps/shell/browser/shell_app_window_controller.h" |
8 #include "apps/shell/common/switches.h" | 8 #include "apps/shell/common/switches.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "content/public/browser/context_factory.h" | 10 #include "content/public/browser/context_factory.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 InitWindowManager(); | 254 InitWindowManager(); |
255 | 255 |
256 host_->AddObserver(this); | 256 host_->AddObserver(this); |
257 | 257 |
258 // Ensure the X window gets mapped. | 258 // Ensure the X window gets mapped. |
259 host_->Show(); | 259 host_->Show(); |
260 } | 260 } |
261 | 261 |
262 void ShellDesktopController::InitWindowManager() { | 262 void ShellDesktopController::InitWindowManager() { |
263 wm::FocusController* focus_controller = | 263 wm::FocusController* focus_controller = |
264 new wm::FocusController(new AppsFocusRules()); | 264 new wm::FocusController(CreateFocusRules()); |
265 aura::client::SetFocusClient(host_->window(), focus_controller); | 265 aura::client::SetFocusClient(host_->window(), focus_controller); |
266 host_->window()->AddPreTargetHandler(focus_controller); | 266 host_->window()->AddPreTargetHandler(focus_controller); |
267 aura::client::SetActivationClient(host_->window(), focus_controller); | 267 aura::client::SetActivationClient(host_->window(), focus_controller); |
268 focus_client_.reset(focus_controller); | 268 focus_client_.reset(focus_controller); |
269 | 269 |
270 input_method_filter_.reset( | 270 input_method_filter_.reset( |
271 new wm::InputMethodEventFilter(host_->GetAcceleratedWidget())); | 271 new wm::InputMethodEventFilter(host_->GetAcceleratedWidget())); |
272 input_method_filter_->SetInputMethodPropertyInRootWindow(host_->window()); | 272 input_method_filter_->SetInputMethodPropertyInRootWindow(host_->window()); |
273 root_window_event_filter_->AddHandler(input_method_filter_.get()); | 273 root_window_event_filter_->AddHandler(input_method_filter_.get()); |
274 | 274 |
(...skipping 13 matching lines...) Expand all Loading... |
288 | 288 |
289 user_activity_detector_.reset(new wm::UserActivityDetector); | 289 user_activity_detector_.reset(new wm::UserActivityDetector); |
290 host_->event_processor()->GetRootTarget()->AddPreTargetHandler( | 290 host_->event_processor()->GetRootTarget()->AddPreTargetHandler( |
291 user_activity_detector_.get()); | 291 user_activity_detector_.get()); |
292 #if defined(OS_CHROMEOS) | 292 #if defined(OS_CHROMEOS) |
293 user_activity_notifier_.reset( | 293 user_activity_notifier_.reset( |
294 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); | 294 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); |
295 #endif | 295 #endif |
296 } | 296 } |
297 | 297 |
| 298 wm::FocusRules* ShellDesktopController::CreateFocusRules() { |
| 299 return new AppsFocusRules(); |
| 300 } |
| 301 |
298 void ShellDesktopController::DestroyRootWindow() { | 302 void ShellDesktopController::DestroyRootWindow() { |
299 host_->RemoveObserver(this); | 303 host_->RemoveObserver(this); |
300 if (input_method_filter_) | 304 if (input_method_filter_) |
301 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); | 305 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); |
302 if (user_activity_detector_) { | 306 if (user_activity_detector_) { |
303 host_->event_processor()->GetRootTarget()->RemovePreTargetHandler( | 307 host_->event_processor()->GetRootTarget()->RemovePreTargetHandler( |
304 user_activity_detector_.get()); | 308 user_activity_detector_.get()); |
305 } | 309 } |
306 wm::FocusController* focus_controller = | 310 wm::FocusController* focus_controller = |
307 static_cast<wm::FocusController*>(focus_client_.get()); | 311 static_cast<wm::FocusController*>(focus_client_.get()); |
(...skipping 20 matching lines...) Expand all Loading... |
328 if (displays.empty()) | 332 if (displays.empty()) |
329 return gfx::Size(); | 333 return gfx::Size(); |
330 const ui::DisplayMode* mode = displays[0].display->current_mode(); | 334 const ui::DisplayMode* mode = displays[0].display->current_mode(); |
331 return mode ? mode->size() : gfx::Size(); | 335 return mode ? mode->size() : gfx::Size(); |
332 #else | 336 #else |
333 return gfx::Size(); | 337 return gfx::Size(); |
334 #endif | 338 #endif |
335 } | 339 } |
336 | 340 |
337 } // namespace apps | 341 } // namespace apps |
OLD | NEW |