| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "apps/ui/views/app_window_frame_view.h" | 9 #include "apps/ui/views/app_window_frame_view.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // First normal states are checked. | 96 // First normal states are checked. |
| 97 if (IsMaximized()) | 97 if (IsMaximized()) |
| 98 return ui::SHOW_STATE_MAXIMIZED; | 98 return ui::SHOW_STATE_MAXIMIZED; |
| 99 if (IsFullscreen()) { | 99 if (IsFullscreen()) { |
| 100 return ui::SHOW_STATE_FULLSCREEN; | 100 return ui::SHOW_STATE_FULLSCREEN; |
| 101 } | 101 } |
| 102 | 102 |
| 103 // Use kPreMinimizedShowStateKey in case a window is minimized/hidden. | 103 // Use kPreMinimizedShowStateKey in case a window is minimized/hidden. |
| 104 ui::WindowShowState restore_state = widget()->GetNativeWindow()->GetProperty( | 104 ui::WindowShowState restore_state = widget()->GetNativeWindow()->GetProperty( |
| 105 aura::client::kPreMinimizedShowStateKey); | 105 aura::client::kPreMinimizedShowStateKey); |
| 106 |
| 107 // TODO(afakhry): Remove in M58. |
| 106 if (widget()->GetNativeWindow()->GetProperty(aura::client::kShowStateKey) == | 108 if (widget()->GetNativeWindow()->GetProperty(aura::client::kShowStateKey) == |
| 107 ui::SHOW_STATE_DOCKED || | 109 ui::SHOW_STATE_DOCKED || |
| 108 restore_state == ui::SHOW_STATE_DOCKED) { | 110 restore_state == ui::SHOW_STATE_DOCKED) { |
| 109 return ui::SHOW_STATE_DOCKED; | 111 return ui::SHOW_STATE_DOCKED; |
| 110 } | 112 } |
| 111 | 113 |
| 112 return GetRestorableState(restore_state); | 114 return GetRestorableState(restore_state); |
| 113 } | 115 } |
| 114 | 116 |
| 115 bool ChromeNativeAppWindowViewsAura::IsAlwaysOnTop() const { | 117 bool ChromeNativeAppWindowViewsAura::IsAlwaysOnTop() const { |
| 116 return widget()->IsAlwaysOnTop(); | 118 return widget()->IsAlwaysOnTop(); |
| 117 } | 119 } |
| 118 | 120 |
| 119 void ChromeNativeAppWindowViewsAura::UpdateShape( | 121 void ChromeNativeAppWindowViewsAura::UpdateShape( |
| 120 std::unique_ptr<SkRegion> region) { | 122 std::unique_ptr<SkRegion> region) { |
| 121 bool had_shape = !!shape(); | 123 bool had_shape = !!shape(); |
| 122 | 124 |
| 123 ChromeNativeAppWindowViews::UpdateShape(std::move(region)); | 125 ChromeNativeAppWindowViews::UpdateShape(std::move(region)); |
| 124 | 126 |
| 125 aura::Window* native_window = widget()->GetNativeWindow(); | 127 aura::Window* native_window = widget()->GetNativeWindow(); |
| 126 if (shape() && !had_shape) { | 128 if (shape() && !had_shape) { |
| 127 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( | 129 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( |
| 128 new ShapedAppWindowTargeter(native_window, this))); | 130 new ShapedAppWindowTargeter(native_window, this))); |
| 129 } else if (!shape() && had_shape) { | 131 } else if (!shape() && had_shape) { |
| 130 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>()); | 132 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>()); |
| 131 } | 133 } |
| 132 } | 134 } |
| OLD | NEW |