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 <utility> |
| 8 |
7 #include "apps/ui/views/app_window_frame_view.h" | 9 #include "apps/ui/views/app_window_frame_view.h" |
8 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
9 #include "ash/frame/custom_frame_view_ash.h" | 11 #include "ash/frame/custom_frame_view_ash.h" |
10 #include "ash/screen_util.h" | 12 #include "ash/screen_util.h" |
11 #include "ash/shell.h" | 13 #include "ash/shell.h" |
12 #include "ash/wm/immersive_fullscreen_controller.h" | 14 #include "ash/wm/immersive_fullscreen_controller.h" |
13 #include "ash/wm/panels/panel_frame_view.h" | 15 #include "ash/wm/panels/panel_frame_view.h" |
14 #include "ash/wm/window_properties.h" | 16 #include "ash/wm/window_properties.h" |
15 #include "ash/wm/window_state.h" | 17 #include "ash/wm/window_state.h" |
16 #include "ash/wm/window_state_delegate.h" | 18 #include "ash/wm/window_state_delegate.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 #endif | 314 #endif |
313 } | 315 } |
314 | 316 |
315 views::NonClientFrameView* | 317 views::NonClientFrameView* |
316 ChromeNativeAppWindowViewsAura::CreateNonClientFrameView( | 318 ChromeNativeAppWindowViewsAura::CreateNonClientFrameView( |
317 views::Widget* widget) { | 319 views::Widget* widget) { |
318 if (chrome::IsNativeViewInAsh(widget->GetNativeView())) { | 320 if (chrome::IsNativeViewInAsh(widget->GetNativeView())) { |
319 // Set the delegate now because CustomFrameViewAsh sets the | 321 // Set the delegate now because CustomFrameViewAsh sets the |
320 // WindowStateDelegate if one is not already set. | 322 // WindowStateDelegate if one is not already set. |
321 ash::wm::GetWindowState(GetNativeWindow()) | 323 ash::wm::GetWindowState(GetNativeWindow()) |
322 ->SetDelegate( | 324 ->SetDelegate(scoped_ptr<ash::wm::WindowStateDelegate>( |
323 scoped_ptr<ash::wm::WindowStateDelegate>( | 325 new NativeAppWindowStateDelegate(app_window(), this))); |
324 new NativeAppWindowStateDelegate(app_window(), this)).Pass()); | |
325 | 326 |
326 if (IsFrameless()) | 327 if (IsFrameless()) |
327 return CreateNonStandardAppFrame(); | 328 return CreateNonStandardAppFrame(); |
328 | 329 |
329 if (app_window()->window_type_is_panel()) { | 330 if (app_window()->window_type_is_panel()) { |
330 ash::PanelFrameView* frame_view = | 331 ash::PanelFrameView* frame_view = |
331 new ash::PanelFrameView(widget, ash::PanelFrameView::FRAME_ASH); | 332 new ash::PanelFrameView(widget, ash::PanelFrameView::FRAME_ASH); |
332 frame_view->set_context_menu_controller(this); | 333 frame_view->set_context_menu_controller(this); |
333 if (HasFrameColor()) | 334 if (HasFrameColor()) |
334 frame_view->SetFrameColors(ActiveFrameColor(), InactiveFrameColor()); | 335 frame_view->SetFrameColors(ActiveFrameColor(), InactiveFrameColor()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 window_state->set_hide_shelf_when_fullscreen(fullscreen_types != | 372 window_state->set_hide_shelf_when_fullscreen(fullscreen_types != |
372 AppWindow::FULLSCREEN_TYPE_OS); | 373 AppWindow::FULLSCREEN_TYPE_OS); |
373 DCHECK(ash::Shell::HasInstance()); | 374 DCHECK(ash::Shell::HasInstance()); |
374 ash::Shell::GetInstance()->UpdateShelfVisibility(); | 375 ash::Shell::GetInstance()->UpdateShelfVisibility(); |
375 } | 376 } |
376 } | 377 } |
377 | 378 |
378 void ChromeNativeAppWindowViewsAura::UpdateShape(scoped_ptr<SkRegion> region) { | 379 void ChromeNativeAppWindowViewsAura::UpdateShape(scoped_ptr<SkRegion> region) { |
379 bool had_shape = !!shape(); | 380 bool had_shape = !!shape(); |
380 | 381 |
381 ChromeNativeAppWindowViews::UpdateShape(region.Pass()); | 382 ChromeNativeAppWindowViews::UpdateShape(std::move(region)); |
382 | 383 |
383 aura::Window* native_window = widget()->GetNativeWindow(); | 384 aura::Window* native_window = widget()->GetNativeWindow(); |
384 if (shape() && !had_shape) { | 385 if (shape() && !had_shape) { |
385 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( | 386 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( |
386 new ShapedAppWindowTargeter(native_window, this))); | 387 new ShapedAppWindowTargeter(native_window, this))); |
387 } else if (!shape() && had_shape) { | 388 } else if (!shape() && had_shape) { |
388 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>()); | 389 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>()); |
389 } | 390 } |
390 } | 391 } |
OLD | NEW |