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 "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" | 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" |
6 | 6 |
7 #include "apps/ui/views/app_window_frame_view.h" | 7 #include "apps/ui/views/app_window_frame_view.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/app_mode/app_mode_utils.h" | 10 #include "chrome/browser/app_mode/app_mode_utils.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 native_window->GetBoundsInScreen()); | 325 native_window->GetBoundsInScreen()); |
326 widget()->SetBounds(window_bounds); | 326 widget()->SetBounds(window_bounds); |
327 } | 327 } |
328 #else | 328 #else |
329 // TODO(stevenjb): NativeAppWindow panels need to be implemented for other | 329 // TODO(stevenjb): NativeAppWindow panels need to be implemented for other |
330 // platforms. | 330 // platforms. |
331 #endif | 331 #endif |
332 } | 332 } |
333 | 333 |
334 void ChromeNativeAppWindowViews::InstallEasyResizeTargeterOnContainer() const { | 334 void ChromeNativeAppWindowViews::InstallEasyResizeTargeterOnContainer() const { |
335 aura::Window* root_window = widget()->GetNativeWindow()->GetRootWindow(); | 335 aura::Window* window = widget()->GetNativeWindow(); |
336 gfx::Insets inset(kResizeInsideBoundsSize, kResizeInsideBoundsSize, | 336 gfx::Insets inset(kResizeInsideBoundsSize, kResizeInsideBoundsSize, |
337 kResizeInsideBoundsSize, kResizeInsideBoundsSize); | 337 kResizeInsideBoundsSize, kResizeInsideBoundsSize); |
338 root_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( | 338 // Add the EasyResizeWindowTargeter on the window, not its root window. The |
339 new wm::EasyResizeWindowTargeter(root_window, inset, inset))); | 339 // root window does not have a delegate, so it will not handle the event in |
| 340 // Linux. |
| 341 window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( |
| 342 new wm::EasyResizeWindowTargeter(window, inset, inset))); |
340 } | 343 } |
341 | 344 |
342 apps::AppWindowFrameView* | 345 apps::AppWindowFrameView* |
343 ChromeNativeAppWindowViews::CreateAppWindowFrameView() { | 346 ChromeNativeAppWindowViews::CreateAppWindowFrameView() { |
344 // By default the user can resize the window from slightly inside the bounds. | 347 // By default the user can resize the window from slightly inside the bounds. |
345 int resize_inside_bounds_size = kResizeInsideBoundsSize; | 348 int resize_inside_bounds_size = kResizeInsideBoundsSize; |
346 int resize_outside_bounds_size = 0; | 349 int resize_outside_bounds_size = 0; |
347 int resize_outside_scale_for_touch = 1; | 350 int resize_outside_scale_for_touch = 1; |
348 int resize_area_corner_size = kResizeAreaCornerSize; | 351 int resize_area_corner_size = kResizeAreaCornerSize; |
349 #if defined(USE_ASH) | 352 #if defined(USE_ASH) |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 InitializePanelWindow(create_params); | 667 InitializePanelWindow(create_params); |
665 } else { | 668 } else { |
666 InitializeDefaultWindow(create_params); | 669 InitializeDefaultWindow(create_params); |
667 } | 670 } |
668 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 671 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( |
669 Profile::FromBrowserContext(app_window->browser_context()), | 672 Profile::FromBrowserContext(app_window->browser_context()), |
670 widget()->GetFocusManager(), | 673 widget()->GetFocusManager(), |
671 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 674 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
672 NULL)); | 675 NULL)); |
673 | 676 |
674 #if defined(OS_WIN) | 677 #if !defined(OS_CHROMEOS) |
675 if ((IsFrameless() || has_frame_color_) && | 678 if ((IsFrameless() || has_frame_color_) && |
676 chrome::GetHostDesktopTypeForNativeWindow(widget()->GetNativeWindow()) != | 679 chrome::GetHostDesktopTypeForNativeWindow(widget()->GetNativeWindow()) != |
677 chrome::HOST_DESKTOP_TYPE_ASH) { | 680 chrome::HOST_DESKTOP_TYPE_ASH) { |
678 InstallEasyResizeTargeterOnContainer(); | 681 InstallEasyResizeTargeterOnContainer(); |
679 } | 682 } |
680 #endif | 683 #endif |
681 } | 684 } |
OLD | NEW |