| Index: chrome/browser/ui/views/frame/browser_frame_ash.cc
|
| diff --git a/chrome/browser/ui/views/frame/browser_frame_ash.cc b/chrome/browser/ui/views/frame/browser_frame_ash.cc
|
| index 44f0c7e0a3e69fd785a6fa4870ebd5f54d5064ba..4d2c5f8f93792ec4047a023dabf8531c73e95a09 100644
|
| --- a/chrome/browser/ui/views/frame/browser_frame_ash.cc
|
| +++ b/chrome/browser/ui/views/frame/browser_frame_ash.cc
|
| @@ -7,73 +7,11 @@
|
| #include "ash/wm/window_state.h"
|
| #include "ash/wm/window_util.h"
|
| #include "chrome/browser/ui/views/frame/browser_view.h"
|
| -#include "ui/aura/client/aura_constants.h"
|
| +#include "chrome/browser/ui/views/frame/non_client_frame_view_switcher_ash.h"
|
| #include "ui/aura/window.h"
|
| -#include "ui/aura/window_observer.h"
|
| #include "ui/gfx/font.h"
|
| #include "ui/views/view.h"
|
|
|
| -using aura::Window;
|
| -
|
| -////////////////////////////////////////////////////////////////////////////////
|
| -// BrowserFrameAsh::WindowPropertyWatcher
|
| -
|
| -class BrowserFrameAsh::WindowPropertyWatcher : public aura::WindowObserver {
|
| - public:
|
| - explicit WindowPropertyWatcher(BrowserFrameAsh* browser_frame_ash,
|
| - BrowserFrame* browser_frame)
|
| - : browser_frame_ash_(browser_frame_ash),
|
| - browser_frame_(browser_frame) {}
|
| -
|
| - virtual void OnWindowPropertyChanged(aura::Window* window,
|
| - const void* key,
|
| - intptr_t old) OVERRIDE {
|
| - if (key != aura::client::kShowStateKey)
|
| - return;
|
| -
|
| - ui::WindowShowState old_state = static_cast<ui::WindowShowState>(old);
|
| - ui::WindowShowState new_state =
|
| - window->GetProperty(aura::client::kShowStateKey);
|
| -
|
| - // Allow the frame to be replaced when entering or exiting the maximized
|
| - // state.
|
| - if (browser_frame_->non_client_view() &&
|
| - browser_frame_ash_->browser_view()->browser()->is_app() &&
|
| - (old_state == ui::SHOW_STATE_MAXIMIZED ||
|
| - new_state == ui::SHOW_STATE_MAXIMIZED)) {
|
| - // Defer frame layout when replacing the frame. Layout will occur when the
|
| - // window's bounds are updated. The window maximize/restore animations
|
| - // clone the window's layers and rely on the subsequent layout to set
|
| - // the layer sizes.
|
| - // If the window is minimized, the frame view needs to be updated via
|
| - // an OnBoundsChanged event so that the frame will change its size
|
| - // properly.
|
| - browser_frame_->non_client_view()->UpdateFrame(
|
| - old_state == ui::SHOW_STATE_MINIMIZED);
|
| - }
|
| - }
|
| -
|
| - virtual void OnWindowBoundsChanged(aura::Window* window,
|
| - const gfx::Rect& old_bounds,
|
| - const gfx::Rect& new_bounds) OVERRIDE {
|
| - // Don't do anything if we don't have our non-client view yet.
|
| - if (!browser_frame_->non_client_view())
|
| - return;
|
| -
|
| - // If the window just moved to the top of the screen, or just moved away
|
| - // from it, invoke Layout() so the header size can change.
|
| - if ((old_bounds.y() == 0 && new_bounds.y() != 0) ||
|
| - (old_bounds.y() != 0 && new_bounds.y() == 0))
|
| - browser_frame_->non_client_view()->Layout();
|
| - }
|
| -
|
| - private:
|
| - BrowserFrameAsh* browser_frame_ash_;
|
| - BrowserFrame* browser_frame_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(WindowPropertyWatcher);
|
| -};
|
| -
|
| ///////////////////////////////////////////////////////////////////////////////
|
| // BrowserFrameAsh, public:
|
|
|
| @@ -83,10 +21,14 @@ const char BrowserFrameAsh::kWindowName[] = "BrowserFrameAsh";
|
| BrowserFrameAsh::BrowserFrameAsh(BrowserFrame* browser_frame,
|
| BrowserView* browser_view)
|
| : views::NativeWidgetAura(browser_frame),
|
| - browser_view_(browser_view),
|
| - window_property_watcher_(new WindowPropertyWatcher(this, browser_frame)) {
|
| + browser_view_(browser_view) {
|
| GetNativeWindow()->SetName(kWindowName);
|
| - GetNativeWindow()->AddObserver(window_property_watcher_.get());
|
| + if (browser_view->browser()->is_app()) {
|
| + // Apps switch to a special non client frame view when maximized.
|
| + browser_frame_switcher_.reset(new NonClientFrameViewSwitcherAsh(
|
| + browser_frame, GetNativeWindow()));
|
| + }
|
| +
|
| if (browser_view->browser()->is_type_tabbed())
|
| ash::wm::SetAnimateToFullscreen(GetNativeWindow(), false);
|
|
|
| @@ -98,14 +40,7 @@ BrowserFrameAsh::BrowserFrameAsh(BrowserFrame* browser_frame,
|
| }
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| -// BrowserFrameAsh, views::NativeWidgetAura overrides:
|
| -
|
| -void BrowserFrameAsh::OnWindowDestroying() {
|
| - // Window is destroyed before our destructor is called, so clean up our
|
| - // observer here.
|
| - GetNativeWindow()->RemoveObserver(window_property_watcher_.get());
|
| - views::NativeWidgetAura::OnWindowDestroying();
|
| -}
|
| +// BrowserFrameAsh, views::NativeWidgetAura override:
|
|
|
| void BrowserFrameAsh::OnWindowTargetVisibilityChanged(bool visible) {
|
| if (visible) {
|
|
|