| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_aura.h" | 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.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 "ash/ash_constants.h" | 8 #include "ash/ash_constants.h" |
| 9 #include "ash/frame/custom_frame_view_ash.h" | 9 #include "ash/frame/custom_frame_view_ash.h" |
| 10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 ChromeNativeAppWindowViewsAura::~ChromeNativeAppWindowViewsAura() { | 124 ChromeNativeAppWindowViewsAura::~ChromeNativeAppWindowViewsAura() { |
| 125 } | 125 } |
| 126 | 126 |
| 127 void ChromeNativeAppWindowViewsAura::InitializeWindow( | 127 void ChromeNativeAppWindowViewsAura::InitializeWindow( |
| 128 AppWindow* app_window, | 128 AppWindow* app_window, |
| 129 const AppWindow::CreateParams& create_params) { | 129 const AppWindow::CreateParams& create_params) { |
| 130 ChromeNativeAppWindowViews::InitializeWindow(app_window, create_params); | 130 ChromeNativeAppWindowViews::InitializeWindow(app_window, create_params); |
| 131 // Restore docked state on ash desktop and ignore it elsewhere. | 131 // Restore docked state on ash desktop and ignore it elsewhere. |
| 132 if (create_params.state == ui::SHOW_STATE_DOCKED && | 132 if (create_params.state == ui::SHOW_STATE_DOCKED && |
| 133 chrome::GetHostDesktopTypeForNativeWindow(widget()->GetNativeWindow()) == | 133 chrome::GetHostDesktopTypeForNativeWindow(widget()->GetNativeWindow()) == |
| 134 chrome::HOST_DESKTOP_TYPE_ASH) { | 134 ui::HOST_DESKTOP_TYPE_ASH) { |
| 135 widget()->GetNativeWindow()->SetProperty(aura::client::kShowStateKey, | 135 widget()->GetNativeWindow()->SetProperty(aura::client::kShowStateKey, |
| 136 create_params.state); | 136 create_params.state); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 void ChromeNativeAppWindowViewsAura::OnBeforeWidgetInit( | 140 void ChromeNativeAppWindowViewsAura::OnBeforeWidgetInit( |
| 141 const AppWindow::CreateParams& create_params, | 141 const AppWindow::CreateParams& create_params, |
| 142 views::Widget::InitParams* init_params, | 142 views::Widget::InitParams* init_params, |
| 143 views::Widget* widget) { | 143 views::Widget* widget) { |
| 144 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 144 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 if (chrome::IsNativeWindowInAsh(widget()->GetNativeWindow())) { | 192 if (chrome::IsNativeWindowInAsh(widget()->GetNativeWindow())) { |
| 193 frame->SetResizeSizes(ash::kResizeInsideBoundsSize, | 193 frame->SetResizeSizes(ash::kResizeInsideBoundsSize, |
| 194 ash::kResizeOutsideBoundsSize, | 194 ash::kResizeOutsideBoundsSize, |
| 195 ash::kResizeAreaCornerSize); | 195 ash::kResizeAreaCornerSize); |
| 196 } | 196 } |
| 197 | 197 |
| 198 #if !defined(OS_CHROMEOS) | 198 #if !defined(OS_CHROMEOS) |
| 199 // For non-Ash windows, install an easy resize window targeter, which ensures | 199 // For non-Ash windows, install an easy resize window targeter, which ensures |
| 200 // that the root window (not the app) receives mouse events on the edges. | 200 // that the root window (not the app) receives mouse events on the edges. |
| 201 if (chrome::GetHostDesktopTypeForNativeWindow(widget()->GetNativeWindow()) != | 201 if (chrome::GetHostDesktopTypeForNativeWindow(widget()->GetNativeWindow()) != |
| 202 chrome::HOST_DESKTOP_TYPE_ASH) { | 202 ui::HOST_DESKTOP_TYPE_ASH) { |
| 203 aura::Window* window = widget()->GetNativeWindow(); | 203 aura::Window* window = widget()->GetNativeWindow(); |
| 204 int resize_inside = frame->resize_inside_bounds_size(); | 204 int resize_inside = frame->resize_inside_bounds_size(); |
| 205 gfx::Insets inset(resize_inside, resize_inside, resize_inside, | 205 gfx::Insets inset(resize_inside, resize_inside, resize_inside, |
| 206 resize_inside); | 206 resize_inside); |
| 207 // Add the AppWindowEasyResizeWindowTargeter on the window, not its root | 207 // Add the AppWindowEasyResizeWindowTargeter on the window, not its root |
| 208 // window. The root window does not have a delegate, which is needed to | 208 // window. The root window does not have a delegate, which is needed to |
| 209 // handle the event in Linux. | 209 // handle the event in Linux. |
| 210 window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( | 210 window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( |
| 211 new AppWindowEasyResizeWindowTargeter(window, inset, this))); | 211 new AppWindowEasyResizeWindowTargeter(window, inset, this))); |
| 212 } | 212 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 ChromeNativeAppWindowViews::UpdateShape(region.Pass()); | 377 ChromeNativeAppWindowViews::UpdateShape(region.Pass()); |
| 378 | 378 |
| 379 aura::Window* native_window = widget()->GetNativeWindow(); | 379 aura::Window* native_window = widget()->GetNativeWindow(); |
| 380 if (shape() && !had_shape) { | 380 if (shape() && !had_shape) { |
| 381 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( | 381 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( |
| 382 new ShapedAppWindowTargeter(native_window, this))); | 382 new ShapedAppWindowTargeter(native_window, this))); |
| 383 } else if (!shape() && had_shape) { | 383 } else if (!shape() && had_shape) { |
| 384 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>()); | 384 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>()); |
| 385 } | 385 } |
| 386 } | 386 } |
| OLD | NEW |