Chromium Code Reviews| 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/wm/window_state.h" | 7 #include "ash/wm/window_state.h" |
| 8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 9 #include "chrome/browser/ui/views/frame/browser_view.h" | 9 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 // static | 79 // static |
| 80 const char BrowserFrameAsh::kWindowName[] = "BrowserFrameAsh"; | 80 const char BrowserFrameAsh::kWindowName[] = "BrowserFrameAsh"; |
| 81 | 81 |
| 82 BrowserFrameAsh::BrowserFrameAsh(BrowserFrame* browser_frame, | 82 BrowserFrameAsh::BrowserFrameAsh(BrowserFrame* browser_frame, |
| 83 BrowserView* browser_view) | 83 BrowserView* browser_view) |
| 84 : views::NativeWidgetAura(browser_frame), | 84 : views::NativeWidgetAura(browser_frame), |
| 85 browser_view_(browser_view), | 85 browser_view_(browser_view), |
| 86 window_property_watcher_(new WindowPropertyWatcher(this, browser_frame)) { | 86 window_property_watcher_(new WindowPropertyWatcher(this, browser_frame)) { |
| 87 GetNativeWindow()->SetName(kWindowName); | 87 GetNativeWindow()->SetName(kWindowName); |
| 88 GetNativeWindow()->AddObserver(window_property_watcher_.get()); | 88 GetNativeWindow()->AddObserver(window_property_watcher_.get()); |
| 89 if (browser_view->browser()->is_type_tabbed()) | 89 Browser* browser = browser_view->browser(); |
| 90 ash::wm::SetAnimateToFullscreen(GetNativeWindow(), false); | 90 ash::wm::WindowState* window_state = |
| 91 ash::wm::GetWindowState(GetNativeWindow()); | |
|
pkotwicz
2013/10/29 00:46:01
This class needs a WindowStateDelegate.
With the C
oshima
2013/10/29 02:05:42
Sorry I misunderstood your original comment. Fixed
| |
| 92 window_state->set_animate_to_fullscreen(!browser->is_type_tabbed()); | |
| 91 | 93 |
| 92 // Turn on auto window management if we don't need an explicit bounds. | 94 // Turn on auto window management if we don't need an explicit bounds. |
| 93 // This way the requested bounds are honored. | 95 // This way the requested bounds are honored. |
| 94 if (!browser_view->browser()->bounds_overridden() && | 96 if (!browser->bounds_overridden() && !browser->is_session_restore()) |
| 95 !browser_view->browser()->is_session_restore()) | |
| 96 SetWindowAutoManaged(); | 97 SetWindowAutoManaged(); |
| 97 #if defined(OS_CHROMEOS) | 98 #if defined(OS_CHROMEOS) |
| 98 // For legacy reasons v1 apps (like Secure Shell) are allowed to consume keys | 99 // For legacy reasons v1 apps (like Secure Shell) are allowed to consume keys |
| 99 // like brightness, volume, etc. Otherwise these keys are handled by the | 100 // like brightness, volume, etc. Otherwise these keys are handled by the |
| 100 // Ash window manager. | 101 // Ash window manager. |
| 101 if (browser_view->browser()->is_app()) { | 102 window_state->set_can_consume_system_keys(browser->is_app()); |
| 102 ash::wm::GetWindowState(GetNativeWindow())-> | |
| 103 set_can_consume_system_keys(true); | |
| 104 } | |
| 105 #endif // defined(OS_CHROMEOS) | 103 #endif // defined(OS_CHROMEOS) |
| 106 } | 104 } |
| 107 | 105 |
| 108 /////////////////////////////////////////////////////////////////////////////// | 106 /////////////////////////////////////////////////////////////////////////////// |
| 109 // BrowserFrameAsh, views::NativeWidgetAura overrides: | 107 // BrowserFrameAsh, views::NativeWidgetAura overrides: |
| 110 | 108 |
| 111 void BrowserFrameAsh::OnWindowDestroying() { | 109 void BrowserFrameAsh::OnWindowDestroying() { |
| 112 // Window is destroyed before our destructor is called, so clean up our | 110 // Window is destroyed before our destructor is called, so clean up our |
| 113 // observer here. | 111 // observer here. |
| 114 GetNativeWindow()->RemoveObserver(window_property_watcher_.get()); | 112 GetNativeWindow()->RemoveObserver(window_property_watcher_.get()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 BrowserFrameAsh::~BrowserFrameAsh() { | 150 BrowserFrameAsh::~BrowserFrameAsh() { |
| 153 } | 151 } |
| 154 | 152 |
| 155 void BrowserFrameAsh::SetWindowAutoManaged() { | 153 void BrowserFrameAsh::SetWindowAutoManaged() { |
| 156 if (browser_view_->browser()->type() != Browser::TYPE_POPUP || | 154 if (browser_view_->browser()->type() != Browser::TYPE_POPUP || |
| 157 browser_view_->browser()->is_app()) { | 155 browser_view_->browser()->is_app()) { |
| 158 ash::wm::GetWindowState(GetNativeWindow())-> | 156 ash::wm::GetWindowState(GetNativeWindow())-> |
| 159 set_window_position_managed(true); | 157 set_window_position_managed(true); |
| 160 } | 158 } |
| 161 } | 159 } |
| OLD | NEW |