| Index: chrome/browser/ui/views/apps/chrome_native_app_window_views.cc
|
| diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views.cc
|
| index f1e0e2f5d85d2d001466940ecb1557632362e91e..03279efb1001b56bb74767c7b3d09266cd17f7f1 100644
|
| --- a/chrome/browser/ui/views/apps/chrome_native_app_window_views.cc
|
| +++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views.cc
|
| @@ -18,13 +18,13 @@
|
| #include "chrome/browser/web_applications/web_app.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "extensions/common/extension.h"
|
| -#include "ui/aura/window.h"
|
| #include "ui/base/hit_test.h"
|
| #include "ui/base/models/simple_menu_model.h"
|
| #include "ui/gfx/image/image_skia.h"
|
| #include "ui/views/controls/menu/menu_runner.h"
|
| #include "ui/views/controls/webview/webview.h"
|
| #include "ui/views/widget/widget.h"
|
| +#include "ui/wm/core/easy_resize_window_targeter.h"
|
|
|
| #if defined(OS_LINUX)
|
| #include "chrome/browser/shell_integration_linux.h"
|
| @@ -45,9 +45,14 @@
|
| #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h"
|
| #include "ui/aura/client/aura_constants.h"
|
| #include "ui/aura/client/window_tree_client.h"
|
| +#include "ui/aura/window.h"
|
| #include "ui/aura/window_observer.h"
|
| #endif
|
|
|
| +#if defined(USE_AURA)
|
| +#include "ui/aura/window.h"
|
| +#endif
|
| +
|
| using apps::AppWindow;
|
|
|
| namespace {
|
| @@ -56,6 +61,8 @@ const int kMinPanelWidth = 100;
|
| const int kMinPanelHeight = 100;
|
| const int kDefaultPanelWidth = 200;
|
| const int kDefaultPanelHeight = 300;
|
| +const int kResizeInsideBoundsSize = 5;
|
| +const int kResizeAreaCornerSize = 16;
|
|
|
| struct AcceleratorMapping {
|
| ui::KeyboardCode keycode;
|
| @@ -324,26 +331,41 @@ void ChromeNativeAppWindowViews::InitializePanelWindow(
|
| #endif
|
| }
|
|
|
| -views::NonClientFrameView*
|
| -ChromeNativeAppWindowViews::CreateStandardDesktopAppFrame() {
|
| - return views::WidgetDelegateView::CreateNonClientFrameView(widget());
|
| +void ChromeNativeAppWindowViews::InstallEasyResizeTargeterOnContainer() const {
|
| + aura::Window* root_window = widget()->GetNativeWindow()->GetRootWindow();
|
| + gfx::Insets inset(kResizeInsideBoundsSize, kResizeInsideBoundsSize,
|
| + kResizeInsideBoundsSize, kResizeInsideBoundsSize);
|
| + root_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>(
|
| + new wm::EasyResizeWindowTargeter(root_window, inset, inset)));
|
| }
|
|
|
| apps::AppWindowFrameView*
|
| -ChromeNativeAppWindowViews::CreateNonStandardAppFrame() {
|
| - apps::AppWindowFrameView* frame = new apps::AppWindowFrameView(
|
| - widget(), this, has_frame_color_, frame_color_);
|
| - frame->Init();
|
| +ChromeNativeAppWindowViews::CreateAppWindowFrameView() {
|
| + // By default the user can resize the window from slightly inside the bounds.
|
| + int resize_inside_bounds_size = kResizeInsideBoundsSize;
|
| + int resize_outside_bounds_size = 0;
|
| + int resize_outside_scale_for_touch = 1;
|
| + int resize_area_corner_size = kResizeAreaCornerSize;
|
| #if defined(USE_ASH)
|
| // For Aura windows on the Ash desktop the sizes are different and the user
|
| // can resize the window from slightly outside the bounds as well.
|
| if (chrome::IsNativeWindowInAsh(widget()->GetNativeWindow())) {
|
| - frame->SetResizeSizes(ash::kResizeInsideBoundsSize,
|
| - ash::kResizeOutsideBoundsSize,
|
| - ash::kResizeAreaCornerSize);
|
| + resize_inside_bounds_size = ash::kResizeInsideBoundsSize;
|
| + resize_outside_bounds_size = ash::kResizeOutsideBoundsSize;
|
| + resize_outside_scale_for_touch = ash::kResizeOutsideBoundsScaleForTouch;
|
| + resize_area_corner_size = ash::kResizeAreaCornerSize;
|
| }
|
| #endif
|
| - return frame;
|
| + apps::AppWindowFrameView* frame_view = new apps::AppWindowFrameView();
|
| + frame_view->Init(widget(),
|
| + this,
|
| + has_frame_color_,
|
| + frame_color_,
|
| + resize_inside_bounds_size,
|
| + resize_outside_bounds_size,
|
| + resize_outside_scale_for_touch,
|
| + resize_area_corner_size);
|
| + return frame_view;
|
| }
|
|
|
| // ui::BaseWindow implementation.
|
| @@ -470,33 +492,30 @@ views::NonClientFrameView* ChromeNativeAppWindowViews::CreateNonClientFrameView(
|
| return frame_view;
|
| }
|
|
|
| - if (IsFrameless())
|
| - return CreateNonStandardAppFrame();
|
| -
|
| - ash::CustomFrameViewAsh* custom_frame_view =
|
| - new ash::CustomFrameViewAsh(widget);
|
| + if (!IsFrameless()) {
|
| + ash::CustomFrameViewAsh* custom_frame_view =
|
| + new ash::CustomFrameViewAsh(widget);
|
| #if defined(OS_CHROMEOS)
|
| - // Non-frameless app windows can be put into immersive fullscreen.
|
| - // TODO(pkotwicz): Investigate if immersive fullscreen can be enabled for
|
| - // Windows Ash.
|
| - immersive_fullscreen_controller_.reset(
|
| - new ash::ImmersiveFullscreenController());
|
| - custom_frame_view->InitImmersiveFullscreenControllerForView(
|
| - immersive_fullscreen_controller_.get());
|
| + // Non-frameless app windows can be put into immersive fullscreen.
|
| + // TODO(pkotwicz): Investigate if immersive fullscreen can be enabled for
|
| + // Windows Ash.
|
| + immersive_fullscreen_controller_.reset(
|
| + new ash::ImmersiveFullscreenController());
|
| + custom_frame_view->InitImmersiveFullscreenControllerForView(
|
| + immersive_fullscreen_controller_.get());
|
| #endif
|
| - custom_frame_view->GetHeaderView()->set_context_menu_controller(this);
|
| - return custom_frame_view;
|
| + custom_frame_view->GetHeaderView()->set_context_menu_controller(this);
|
| + return custom_frame_view;
|
| + }
|
| }
|
| #endif
|
| #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
| - // Linux always uses the non standard frame view because the OS draws the
|
| - // frame (if a frame is needed).
|
| - return CreateNonStandardAppFrame();
|
| + return CreateAppWindowFrameView();
|
| #else
|
| if (IsFrameless() || has_frame_color_)
|
| - return CreateNonStandardAppFrame();
|
| + return CreateAppWindowFrameView();
|
| #endif
|
| - return CreateStandardDesktopAppFrame();
|
| + return views::WidgetDelegateView::CreateNonClientFrameView(widget);
|
| }
|
|
|
| bool ChromeNativeAppWindowViews::WidgetHasHitTestMask() const {
|
| @@ -651,4 +670,12 @@ void ChromeNativeAppWindowViews::InitializeWindow(
|
| widget()->GetFocusManager(),
|
| extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
|
| NULL));
|
| +
|
| +#if defined(OS_WIN)
|
| + if ((IsFrameless() || has_frame_color_) &&
|
| + chrome::GetHostDesktopTypeForNativeWindow(widget()->GetNativeWindow()) !=
|
| + chrome::HOST_DESKTOP_TYPE_ASH) {
|
| + InstallEasyResizeTargeterOnContainer();
|
| + }
|
| +#endif
|
| }
|
|
|