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 "extensions/shell/browser/shell_desktop_controller_aura.h" | 5 #include "extensions/shell/browser/shell_desktop_controller_aura.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 262 |
263 capture_client_.reset( | 263 capture_client_.reset( |
264 new aura::client::DefaultCaptureClient(host_->window())); | 264 new aura::client::DefaultCaptureClient(host_->window())); |
265 | 265 |
266 // Ensure new windows fill the display. | 266 // Ensure new windows fill the display. |
267 host_->window()->SetLayoutManager(new FillLayout); | 267 host_->window()->SetLayoutManager(new FillLayout); |
268 | 268 |
269 cursor_manager_.reset( | 269 cursor_manager_.reset( |
270 new wm::CursorManager(scoped_ptr<wm::NativeCursorManager>( | 270 new wm::CursorManager(scoped_ptr<wm::NativeCursorManager>( |
271 new ShellNativeCursorManager(host_.get())))); | 271 new ShellNativeCursorManager(host_.get())))); |
272 cursor_manager_->SetDisplay( | 272 cursor_manager_->SetDisplay(gfx::Screen::GetScreen()->GetPrimaryDisplay()); |
273 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay()); | |
274 cursor_manager_->SetCursor(ui::kCursorPointer); | 273 cursor_manager_->SetCursor(ui::kCursorPointer); |
275 aura::client::SetCursorClient(host_->window(), cursor_manager_.get()); | 274 aura::client::SetCursorClient(host_->window(), cursor_manager_.get()); |
276 | 275 |
277 user_activity_detector_.reset(new ui::UserActivityDetector); | 276 user_activity_detector_.reset(new ui::UserActivityDetector); |
278 #if defined(OS_CHROMEOS) | 277 #if defined(OS_CHROMEOS) |
279 user_activity_notifier_.reset( | 278 user_activity_notifier_.reset( |
280 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); | 279 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); |
281 #endif | 280 #endif |
282 } | 281 } |
283 | 282 |
284 void ShellDesktopControllerAura::CreateRootWindow() { | 283 void ShellDesktopControllerAura::CreateRootWindow() { |
285 // Set up basic pieces of ui::wm. | 284 // Set up basic pieces of ui::wm. |
286 gfx::Size size; | 285 gfx::Size size; |
287 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 286 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
288 if (command_line->HasSwitch(switches::kAppShellHostWindowSize)) { | 287 if (command_line->HasSwitch(switches::kAppShellHostWindowSize)) { |
289 const std::string size_str = | 288 const std::string size_str = |
290 command_line->GetSwitchValueASCII(switches::kAppShellHostWindowSize); | 289 command_line->GetSwitchValueASCII(switches::kAppShellHostWindowSize); |
291 int width, height; | 290 int width, height; |
292 CHECK_EQ(2, sscanf(size_str.c_str(), "%dx%d", &width, &height)); | 291 CHECK_EQ(2, sscanf(size_str.c_str(), "%dx%d", &width, &height)); |
293 size = gfx::Size(width, height); | 292 size = gfx::Size(width, height); |
294 } else { | 293 } else { |
295 size = GetPrimaryDisplaySize(); | 294 size = GetPrimaryDisplaySize(); |
296 } | 295 } |
297 if (size.IsEmpty()) | 296 if (size.IsEmpty()) |
298 size = gfx::Size(1920, 1080); | 297 size = gfx::Size(1920, 1080); |
299 | 298 |
300 screen_.reset(new ShellScreen(size)); | 299 screen_.reset(new ShellScreen(size)); |
301 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); | 300 gfx::Screen::SetScreenInstance(screen_.get()); |
302 // TODO(mukai): Set up input method. | 301 // TODO(mukai): Set up input method. |
303 | 302 |
304 host_.reset(screen_->CreateHostForPrimaryDisplay()); | 303 host_.reset(screen_->CreateHostForPrimaryDisplay()); |
305 aura::client::SetWindowTreeClient(host_->window(), this); | 304 aura::client::SetWindowTreeClient(host_->window(), this); |
306 root_window_event_filter_.reset(new wm::CompoundEventFilter); | 305 root_window_event_filter_.reset(new wm::CompoundEventFilter); |
307 host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); | 306 host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); |
308 InitWindowManager(); | 307 InitWindowManager(); |
309 | 308 |
310 host_->AddObserver(this); | 309 host_->AddObserver(this); |
311 | 310 |
(...skipping 28 matching lines...) Expand all Loading... |
340 if (displays.empty()) | 339 if (displays.empty()) |
341 return gfx::Size(); | 340 return gfx::Size(); |
342 const ui::DisplayMode* mode = displays[0]->current_mode(); | 341 const ui::DisplayMode* mode = displays[0]->current_mode(); |
343 return mode ? mode->size() : gfx::Size(); | 342 return mode ? mode->size() : gfx::Size(); |
344 #else | 343 #else |
345 return gfx::Size(); | 344 return gfx::Size(); |
346 #endif | 345 #endif |
347 } | 346 } |
348 | 347 |
349 } // namespace extensions | 348 } // namespace extensions |
OLD | NEW |