| 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/shell.h" |
| 7 #include "ash/wm/window_properties.h" | 8 #include "ash/wm/window_properties.h" |
| 8 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
| 9 #include "ash/wm/window_state_delegate.h" | 10 #include "ash/wm/window_state_delegate.h" |
| 10 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
| 11 #include "chrome/browser/ui/browser_commands.h" | 12 #include "chrome/browser/ui/browser_commands.h" |
| 12 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
| 13 #include "chrome/browser/ui/views/frame/browser_shutdown.h" | 14 #include "chrome/browser/ui/views/frame/browser_shutdown.h" |
| 14 #include "chrome/browser/ui/views/frame/browser_view.h" | 15 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 15 #include "ui/aura/client/aura_constants.h" | 16 #include "ui/aura/client/aura_constants.h" |
| 16 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
| 17 #include "ui/aura/window_observer.h" | 18 #include "ui/aura/window_observer.h" |
| 18 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
| 19 | 20 |
| 20 using aura::Window; | |
| 21 | |
| 22 namespace { | 21 namespace { |
| 23 | 22 |
| 24 // BrowserWindowStateDelegate class handles a user's fullscreen | 23 // BrowserWindowStateDelegate class handles a user's fullscreen |
| 25 // request (Shift+F4/F4). | 24 // request (Shift+F4/F4). |
| 26 class BrowserWindowStateDelegate : public ash::wm::WindowStateDelegate { | 25 class BrowserWindowStateDelegate : public ash::wm::WindowStateDelegate { |
| 27 public: | 26 public: |
| 28 explicit BrowserWindowStateDelegate(Browser* browser) | 27 explicit BrowserWindowStateDelegate(Browser* browser) |
| 29 : browser_(browser) { | 28 : browser_(browser) { |
| 30 DCHECK(browser_); | 29 DCHECK(browser_); |
| 31 } | 30 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 119 |
| 121 if (*show_state != ui::SHOW_STATE_MAXIMIZED && | 120 if (*show_state != ui::SHOW_STATE_MAXIMIZED && |
| 122 *show_state != ui::SHOW_STATE_MINIMIZED) { | 121 *show_state != ui::SHOW_STATE_MINIMIZED) { |
| 123 *show_state = ui::SHOW_STATE_NORMAL; | 122 *show_state = ui::SHOW_STATE_NORMAL; |
| 124 } | 123 } |
| 125 } | 124 } |
| 126 | 125 |
| 127 //////////////////////////////////////////////////////////////////////////////// | 126 //////////////////////////////////////////////////////////////////////////////// |
| 128 // BrowserFrameAsh, NativeBrowserFrame implementation: | 127 // BrowserFrameAsh, NativeBrowserFrame implementation: |
| 129 | 128 |
| 130 views::NativeWidget* BrowserFrameAsh::AsNativeWidget() { | 129 views::Widget::InitParams BrowserFrameAsh::GetWidgetParams() { |
| 131 return this; | 130 views::Widget::InitParams params; |
| 132 } | 131 params.native_widget = this; |
| 133 | 132 |
| 134 const views::NativeWidget* BrowserFrameAsh::AsNativeWidget() const { | 133 params.context = ash::Shell::GetPrimaryRootWindow(); |
| 135 return this; | 134 #if defined(OS_WIN) |
| 135 // If this window is under ASH on Windows, we need it to be translucent. |
| 136 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 137 #endif |
| 138 |
| 139 return params; |
| 136 } | 140 } |
| 137 | 141 |
| 138 bool BrowserFrameAsh::UsesNativeSystemMenu() const { | 142 bool BrowserFrameAsh::UsesNativeSystemMenu() const { |
| 139 return false; | 143 return false; |
| 140 } | 144 } |
| 141 | 145 |
| 142 int BrowserFrameAsh::GetMinimizeButtonOffset() const { | 146 int BrowserFrameAsh::GetMinimizeButtonOffset() const { |
| 143 return 0; | 147 return 0; |
| 144 } | 148 } |
| 145 | 149 |
| 146 BrowserFrameAsh::~BrowserFrameAsh() { | 150 BrowserFrameAsh::~BrowserFrameAsh() { |
| 147 } | 151 } |
| 148 | 152 |
| 149 /////////////////////////////////////////////////////////////////////////////// | 153 /////////////////////////////////////////////////////////////////////////////// |
| 150 // BrowserFrameAsh, private: | 154 // BrowserFrameAsh, private: |
| 151 | 155 |
| 152 void BrowserFrameAsh::SetWindowAutoManaged() { | 156 void BrowserFrameAsh::SetWindowAutoManaged() { |
| 153 if (!browser_view_->browser()->is_type_popup() || | 157 if (!browser_view_->browser()->is_type_popup() || |
| 154 browser_view_->browser()->is_app()) { | 158 browser_view_->browser()->is_app()) { |
| 155 ash::wm::GetWindowState(GetNativeWindow())-> | 159 ash::wm::GetWindowState(GetNativeWindow())-> |
| 156 set_window_position_managed(true); | 160 set_window_position_managed(true); |
| 157 } | 161 } |
| 158 } | 162 } |
| OLD | NEW |