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