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

Side by Side Diff: extensions/shell/browser/shell_desktop_controller_aura.cc

Issue 1924133002: Rename gfx::Display/Screen to display::Display/Screen in extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
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
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "extensions/browser/app_window/app_window.h" 14 #include "extensions/browser/app_window/app_window.h"
15 #include "extensions/browser/app_window/native_app_window.h" 15 #include "extensions/browser/app_window/native_app_window.h"
16 #include "extensions/shell/browser/shell_app_delegate.h" 16 #include "extensions/shell/browser/shell_app_delegate.h"
17 #include "extensions/shell/browser/shell_app_window_client.h" 17 #include "extensions/shell/browser/shell_app_window_client.h"
18 #include "extensions/shell/browser/shell_screen.h" 18 #include "extensions/shell/browser/shell_screen.h"
19 #include "extensions/shell/common/switches.h" 19 #include "extensions/shell/common/switches.h"
20 #include "ui/aura/client/cursor_client.h" 20 #include "ui/aura/client/cursor_client.h"
21 #include "ui/aura/client/default_capture_client.h" 21 #include "ui/aura/client/default_capture_client.h"
22 #include "ui/aura/layout_manager.h" 22 #include "ui/aura/layout_manager.h"
23 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
24 #include "ui/aura/window_event_dispatcher.h" 24 #include "ui/aura/window_event_dispatcher.h"
25 #include "ui/aura/window_tree_host.h" 25 #include "ui/aura/window_tree_host.h"
26 #include "ui/base/cursor/cursor.h" 26 #include "ui/base/cursor/cursor.h"
27 #include "ui/base/cursor/image_cursors.h" 27 #include "ui/base/cursor/image_cursors.h"
28 #include "ui/base/ime/input_method_initializer.h" 28 #include "ui/base/ime/input_method_initializer.h"
29 #include "ui/base/user_activity/user_activity_detector.h" 29 #include "ui/base/user_activity/user_activity_detector.h"
30 #include "ui/display/screen.h"
30 #include "ui/gfx/geometry/size.h" 31 #include "ui/gfx/geometry/size.h"
31 #include "ui/gfx/native_widget_types.h" 32 #include "ui/gfx/native_widget_types.h"
32 #include "ui/gfx/screen.h"
33 #include "ui/wm/core/base_focus_rules.h" 33 #include "ui/wm/core/base_focus_rules.h"
34 #include "ui/wm/core/compound_event_filter.h" 34 #include "ui/wm/core/compound_event_filter.h"
35 #include "ui/wm/core/cursor_manager.h" 35 #include "ui/wm/core/cursor_manager.h"
36 #include "ui/wm/core/focus_controller.h" 36 #include "ui/wm/core/focus_controller.h"
37 #include "ui/wm/core/native_cursor_manager.h" 37 #include "ui/wm/core/native_cursor_manager.h"
38 #include "ui/wm/core/native_cursor_manager_delegate.h" 38 #include "ui/wm/core/native_cursor_manager_delegate.h"
39 39
40 #if defined(OS_CHROMEOS) 40 #if defined(OS_CHROMEOS)
41 #include "chromeos/dbus/dbus_thread_manager.h" 41 #include "chromeos/dbus/dbus_thread_manager.h"
42 #include "ui/chromeos/user_activity_power_manager_notifier.h" 42 #include "ui/chromeos/user_activity_power_manager_notifier.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 // A class that bridges the gap between CursorManager and Aura. It borrows 94 // A class that bridges the gap between CursorManager and Aura. It borrows
95 // heavily from AshNativeCursorManager. 95 // heavily from AshNativeCursorManager.
96 class ShellNativeCursorManager : public wm::NativeCursorManager { 96 class ShellNativeCursorManager : public wm::NativeCursorManager {
97 public: 97 public:
98 explicit ShellNativeCursorManager(aura::WindowTreeHost* host) 98 explicit ShellNativeCursorManager(aura::WindowTreeHost* host)
99 : host_(host), image_cursors_(new ui::ImageCursors) {} 99 : host_(host), image_cursors_(new ui::ImageCursors) {}
100 ~ShellNativeCursorManager() override {} 100 ~ShellNativeCursorManager() override {}
101 101
102 // wm::NativeCursorManager overrides. 102 // wm::NativeCursorManager overrides.
103 void SetDisplay(const gfx::Display& display, 103 void SetDisplay(const display::Display& display,
104 wm::NativeCursorManagerDelegate* delegate) override { 104 wm::NativeCursorManagerDelegate* delegate) override {
105 if (image_cursors_->SetDisplay(display, display.device_scale_factor())) 105 if (image_cursors_->SetDisplay(display, display.device_scale_factor()))
106 SetCursor(delegate->GetCursor(), delegate); 106 SetCursor(delegate->GetCursor(), delegate);
107 } 107 }
108 108
109 void SetCursor(gfx::NativeCursor cursor, 109 void SetCursor(gfx::NativeCursor cursor,
110 wm::NativeCursorManagerDelegate* delegate) override { 110 wm::NativeCursorManagerDelegate* delegate) override {
111 image_cursors_->SetPlatformCursor(&cursor); 111 image_cursors_->SetPlatformCursor(&cursor);
112 cursor.set_device_scale_factor(image_cursors_->GetScale()); 112 cursor.set_device_scale_factor(image_cursors_->GetScale());
113 delegate->CommitCursor(cursor); 113 delegate->CommitCursor(cursor);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 278
279 capture_client_.reset( 279 capture_client_.reset(
280 new aura::client::DefaultCaptureClient(host_->window())); 280 new aura::client::DefaultCaptureClient(host_->window()));
281 281
282 // Ensure new windows fill the display. 282 // Ensure new windows fill the display.
283 host_->window()->SetLayoutManager(new FillLayout); 283 host_->window()->SetLayoutManager(new FillLayout);
284 284
285 cursor_manager_.reset( 285 cursor_manager_.reset(
286 new wm::CursorManager(std::unique_ptr<wm::NativeCursorManager>( 286 new wm::CursorManager(std::unique_ptr<wm::NativeCursorManager>(
287 new ShellNativeCursorManager(host_.get())))); 287 new ShellNativeCursorManager(host_.get()))));
288 cursor_manager_->SetDisplay(gfx::Screen::GetScreen()->GetPrimaryDisplay()); 288 cursor_manager_->SetDisplay(
289 display::Screen::GetScreen()->GetPrimaryDisplay());
289 cursor_manager_->SetCursor(ui::kCursorPointer); 290 cursor_manager_->SetCursor(ui::kCursorPointer);
290 aura::client::SetCursorClient(host_->window(), cursor_manager_.get()); 291 aura::client::SetCursorClient(host_->window(), cursor_manager_.get());
291 292
292 user_activity_detector_.reset(new ui::UserActivityDetector); 293 user_activity_detector_.reset(new ui::UserActivityDetector);
293 #if defined(OS_CHROMEOS) 294 #if defined(OS_CHROMEOS)
294 user_activity_notifier_.reset( 295 user_activity_notifier_.reset(
295 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); 296 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get()));
296 #endif 297 #endif
297 } 298 }
298 299
299 void ShellDesktopControllerAura::CreateRootWindow() { 300 void ShellDesktopControllerAura::CreateRootWindow() {
300 // Set up basic pieces of ui::wm. 301 // Set up basic pieces of ui::wm.
301 gfx::Size size; 302 gfx::Size size;
302 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 303 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
303 if (command_line->HasSwitch(switches::kAppShellHostWindowSize)) { 304 if (command_line->HasSwitch(switches::kAppShellHostWindowSize)) {
304 const std::string size_str = 305 const std::string size_str =
305 command_line->GetSwitchValueASCII(switches::kAppShellHostWindowSize); 306 command_line->GetSwitchValueASCII(switches::kAppShellHostWindowSize);
306 int width, height; 307 int width, height;
307 CHECK_EQ(2, sscanf(size_str.c_str(), "%dx%d", &width, &height)); 308 CHECK_EQ(2, sscanf(size_str.c_str(), "%dx%d", &width, &height));
308 size = gfx::Size(width, height); 309 size = gfx::Size(width, height);
309 } else { 310 } else {
310 size = GetPrimaryDisplaySize(); 311 size = GetPrimaryDisplaySize();
311 } 312 }
312 if (size.IsEmpty()) 313 if (size.IsEmpty())
313 size = gfx::Size(1920, 1080); 314 size = gfx::Size(1920, 1080);
314 315
315 screen_.reset(new ShellScreen(size)); 316 screen_.reset(new ShellScreen(size));
316 gfx::Screen::SetScreenInstance(screen_.get()); 317 display::Screen::SetScreenInstance(screen_.get());
317 // TODO(mukai): Set up input method. 318 // TODO(mukai): Set up input method.
318 319
319 host_.reset(screen_->CreateHostForPrimaryDisplay()); 320 host_.reset(screen_->CreateHostForPrimaryDisplay());
320 aura::client::SetWindowTreeClient(host_->window(), this); 321 aura::client::SetWindowTreeClient(host_->window(), this);
321 root_window_event_filter_.reset(new wm::CompoundEventFilter); 322 root_window_event_filter_.reset(new wm::CompoundEventFilter);
322 host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); 323 host_->window()->AddPreTargetHandler(root_window_event_filter_.get());
323 InitWindowManager(); 324 InitWindowManager();
324 325
325 host_->AddObserver(this); 326 host_->AddObserver(this);
326 327
(...skipping 28 matching lines...) Expand all
355 if (displays.empty()) 356 if (displays.empty())
356 return gfx::Size(); 357 return gfx::Size();
357 const ui::DisplayMode* mode = displays[0]->current_mode(); 358 const ui::DisplayMode* mode = displays[0]->current_mode();
358 return mode ? mode->size() : gfx::Size(); 359 return mode ? mode->size() : gfx::Size();
359 #else 360 #else
360 return gfx::Size(); 361 return gfx::Size();
361 #endif 362 #endif
362 } 363 }
363 364
364 } // namespace extensions 365 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/app_window/app_window.cc ('k') | extensions/shell/browser/shell_display_info_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698