OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame/browser_frame_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_frame_ash.h" |
6 | 6 |
7 #include "ash/common/wm/window_state.h" | 7 #include "ash/common/wm/window_state.h" |
8 #include "ash/common/wm/window_state_delegate.h" | 8 #include "ash/common/wm/window_state_delegate.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/window_properties.h" | 10 #include "ash/wm/window_properties.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 void BrowserFrameAsh::OnWindowTargetVisibilityChanged(bool visible) { | 84 void BrowserFrameAsh::OnWindowTargetVisibilityChanged(bool visible) { |
85 if (visible) { | 85 if (visible) { |
86 // Once the window has been shown we know the requested bounds | 86 // Once the window has been shown we know the requested bounds |
87 // (if provided) have been honored and we can switch on window management. | 87 // (if provided) have been honored and we can switch on window management. |
88 SetWindowAutoManaged(); | 88 SetWindowAutoManaged(); |
89 } | 89 } |
90 views::NativeWidgetAura::OnWindowTargetVisibilityChanged(visible); | 90 views::NativeWidgetAura::OnWindowTargetVisibilityChanged(visible); |
91 } | 91 } |
92 | 92 |
| 93 //////////////////////////////////////////////////////////////////////////////// |
| 94 // BrowserFrameAsh, NativeBrowserFrame implementation: |
| 95 |
93 bool BrowserFrameAsh::ShouldSaveWindowPlacement() const { | 96 bool BrowserFrameAsh::ShouldSaveWindowPlacement() const { |
94 return nullptr == GetWidget()->GetNativeWindow()->GetProperty( | 97 return nullptr == GetWidget()->GetNativeWindow()->GetProperty( |
95 ash::kRestoreBoundsOverrideKey); | 98 ash::kRestoreBoundsOverrideKey); |
96 } | 99 } |
97 | 100 |
98 void BrowserFrameAsh::GetWindowPlacement( | 101 void BrowserFrameAsh::GetWindowPlacement( |
99 gfx::Rect* bounds, | 102 gfx::Rect* bounds, |
100 ui::WindowShowState* show_state) const { | 103 ui::WindowShowState* show_state) const { |
101 gfx::Rect* override_bounds = GetWidget()->GetNativeWindow()->GetProperty( | 104 gfx::Rect* override_bounds = GetWidget()->GetNativeWindow()->GetProperty( |
102 ash::kRestoreBoundsOverrideKey); | 105 ash::kRestoreBoundsOverrideKey); |
(...skipping 20 matching lines...) Expand all Loading... |
123 // Restore original restore bounds for tabbed browser windows ignoring | 126 // Restore original restore bounds for tabbed browser windows ignoring |
124 // the docked origin. | 127 // the docked origin. |
125 gfx::Rect* restore_bounds = GetWidget()->GetNativeWindow()->GetProperty( | 128 gfx::Rect* restore_bounds = GetWidget()->GetNativeWindow()->GetProperty( |
126 aura::client::kRestoreBoundsKey); | 129 aura::client::kRestoreBoundsKey); |
127 if (restore_bounds) | 130 if (restore_bounds) |
128 *bounds = *restore_bounds; | 131 *bounds = *restore_bounds; |
129 } | 132 } |
130 } | 133 } |
131 } | 134 } |
132 | 135 |
133 //////////////////////////////////////////////////////////////////////////////// | 136 bool BrowserFrameAsh::PreHandleKeyboardEvent( |
134 // BrowserFrameAsh, NativeBrowserFrame implementation: | 137 const content::NativeWebKeyboardEvent& event) { |
| 138 return false; |
| 139 } |
| 140 |
| 141 bool BrowserFrameAsh::HandleKeyboardEvent( |
| 142 const content::NativeWebKeyboardEvent& event) { |
| 143 return false; |
| 144 } |
135 | 145 |
136 views::Widget::InitParams BrowserFrameAsh::GetWidgetParams() { | 146 views::Widget::InitParams BrowserFrameAsh::GetWidgetParams() { |
137 views::Widget::InitParams params; | 147 views::Widget::InitParams params; |
138 params.native_widget = this; | 148 params.native_widget = this; |
139 | 149 |
140 params.context = ash::Shell::GetPrimaryRootWindow(); | 150 params.context = ash::Shell::GetPrimaryRootWindow(); |
141 #if defined(OS_WIN) | 151 #if defined(OS_WIN) |
142 // If this window is under ASH on Windows, we need it to be translucent. | 152 // If this window is under ASH on Windows, we need it to be translucent. |
143 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 153 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
144 #endif | 154 #endif |
(...skipping 19 matching lines...) Expand all Loading... |
164 /////////////////////////////////////////////////////////////////////////////// | 174 /////////////////////////////////////////////////////////////////////////////// |
165 // BrowserFrameAsh, private: | 175 // BrowserFrameAsh, private: |
166 | 176 |
167 void BrowserFrameAsh::SetWindowAutoManaged() { | 177 void BrowserFrameAsh::SetWindowAutoManaged() { |
168 if (!browser_view_->browser()->is_type_popup() || | 178 if (!browser_view_->browser()->is_type_popup() || |
169 browser_view_->browser()->is_app()) { | 179 browser_view_->browser()->is_app()) { |
170 ash::wm::GetWindowState(GetNativeWindow())-> | 180 ash::wm::GetWindowState(GetNativeWindow())-> |
171 set_window_position_managed(true); | 181 set_window_position_managed(true); |
172 } | 182 } |
173 } | 183 } |
OLD | NEW |