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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 ActiveFrameColor(), InactiveFrameColor()); | 79 ActiveFrameColor(), InactiveFrameColor()); |
80 frame->Init(); | 80 frame->Init(); |
81 | 81 |
82 // Install an easy resize window targeter, which ensures that the root window | 82 // Install an easy resize window targeter, which ensures that the root window |
83 // (not the app) receives mouse events on the edges. | 83 // (not the app) receives mouse events on the edges. |
84 aura::Window* window = widget()->GetNativeWindow(); | 84 aura::Window* window = widget()->GetNativeWindow(); |
85 // Add the AppWindowEasyResizeWindowTargeter on the window, not its root | 85 // Add the AppWindowEasyResizeWindowTargeter on the window, not its root |
86 // window. The root window does not have a delegate, which is needed to | 86 // window. The root window does not have a delegate, which is needed to |
87 // handle the event in Linux. | 87 // handle the event in Linux. |
88 window->SetEventTargeter( | 88 window->SetEventTargeter( |
89 scoped_ptr<ui::EventTargeter>(new AppWindowEasyResizeWindowTargeter( | 89 std::unique_ptr<ui::EventTargeter>(new AppWindowEasyResizeWindowTargeter( |
90 window, gfx::Insets(frame->resize_inside_bounds_size()), this))); | 90 window, gfx::Insets(frame->resize_inside_bounds_size()), this))); |
91 | 91 |
92 return frame; | 92 return frame; |
93 } | 93 } |
94 | 94 |
95 ui::WindowShowState ChromeNativeAppWindowViewsAura::GetRestoredState() const { | 95 ui::WindowShowState ChromeNativeAppWindowViewsAura::GetRestoredState() const { |
96 // Use kRestoreShowStateKey in case a window is minimized/hidden. | 96 // Use kRestoreShowStateKey in case a window is minimized/hidden. |
97 ui::WindowShowState restore_state = widget()->GetNativeWindow()->GetProperty( | 97 ui::WindowShowState restore_state = widget()->GetNativeWindow()->GetProperty( |
98 aura::client::kRestoreShowStateKey); | 98 aura::client::kRestoreShowStateKey); |
99 | 99 |
(...skipping 11 matching lines...) Expand all Loading... |
111 return ui::SHOW_STATE_DOCKED; | 111 return ui::SHOW_STATE_DOCKED; |
112 } | 112 } |
113 | 113 |
114 return GetRestorableState(restore_state); | 114 return GetRestorableState(restore_state); |
115 } | 115 } |
116 | 116 |
117 bool ChromeNativeAppWindowViewsAura::IsAlwaysOnTop() const { | 117 bool ChromeNativeAppWindowViewsAura::IsAlwaysOnTop() const { |
118 return widget()->IsAlwaysOnTop(); | 118 return widget()->IsAlwaysOnTop(); |
119 } | 119 } |
120 | 120 |
121 void ChromeNativeAppWindowViewsAura::UpdateShape(scoped_ptr<SkRegion> region) { | 121 void ChromeNativeAppWindowViewsAura::UpdateShape( |
| 122 std::unique_ptr<SkRegion> region) { |
122 bool had_shape = !!shape(); | 123 bool had_shape = !!shape(); |
123 | 124 |
124 ChromeNativeAppWindowViews::UpdateShape(std::move(region)); | 125 ChromeNativeAppWindowViews::UpdateShape(std::move(region)); |
125 | 126 |
126 aura::Window* native_window = widget()->GetNativeWindow(); | 127 aura::Window* native_window = widget()->GetNativeWindow(); |
127 if (shape() && !had_shape) { | 128 if (shape() && !had_shape) { |
128 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( | 129 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( |
129 new ShapedAppWindowTargeter(native_window, this))); | 130 new ShapedAppWindowTargeter(native_window, this))); |
130 } else if (!shape() && had_shape) { | 131 } else if (!shape() && had_shape) { |
131 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>()); | 132 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>()); |
132 } | 133 } |
133 } | 134 } |
OLD | NEW |