| Index: chrome/browser/ui/views/frame/non_client_frame_view_switcher_ash.cc
|
| diff --git a/chrome/browser/ui/views/frame/non_client_frame_view_switcher_ash.cc b/chrome/browser/ui/views/frame/non_client_frame_view_switcher_ash.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..715f92effe98935dece3f0ca258428473ea07702
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/views/frame/non_client_frame_view_switcher_ash.cc
|
| @@ -0,0 +1,45 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/ui/views/frame/non_client_frame_view_switcher_ash.h"
|
| +
|
| +#include "ash/wm/window_state.h"
|
| +#include "ui/aura/window.h"
|
| +#include "ui/views/widget/widget.h"
|
| +#include "ui/views/window/non_client_view.h"
|
| +
|
| +NonClientFrameViewSwitcherAsh::NonClientFrameViewSwitcherAsh(
|
| + views::Widget* frame_widget,
|
| + aura::Window* frame_window)
|
| + : frame_widget_(frame_widget),
|
| + frame_window_(frame_window) {
|
| + frame_window_->AddObserver(this);
|
| + ash::wm::GetWindowState(frame_window_)->AddObserver(this);
|
| +}
|
| +
|
| +NonClientFrameViewSwitcherAsh::~NonClientFrameViewSwitcherAsh() {
|
| + if (frame_window_) {
|
| + frame_window_->RemoveObserver(this);
|
| + ash::wm::GetWindowState(frame_window_)->RemoveObserver(this);
|
| + }
|
| +}
|
| +
|
| +void NonClientFrameViewSwitcherAsh::OnWindowDestroying(aura::Window* window) {
|
| + frame_window_->RemoveObserver(this);
|
| + ash::wm::GetWindowState(frame_window_)->RemoveObserver(this);
|
| + frame_window_ = NULL;
|
| +}
|
| +
|
| +void NonClientFrameViewSwitcherAsh::OnWindowShowTypeChanged(
|
| + ash::wm::WindowState* window_state,
|
| + ash::wm::WindowShowType type) {
|
| + if (frame_widget_->non_client_view() &&
|
| + (window_state->window_show_type() == ash::wm::SHOW_TYPE_MAXIMIZED ||
|
| + type == ash::wm::SHOW_TYPE_MAXIMIZED)) {
|
| + // Defer frame layout when replacing the frame. Layout will occur as a
|
| + // result of WorkspaceLayoutManager::OnWindowShowTypeChanged().
|
| + frame_widget_->non_client_view()->UpdateFrame(
|
| + type == ash::wm::SHOW_TYPE_MINIMIZED);
|
| + }
|
| +}
|
|
|