summaryrefslogtreecommitdiffstats
path: root/ash/wm
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-04 12:46:32 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-04 12:46:32 +0000
commitad9a142a7f2cb9d93c17a0ab62600ea564ee9b2b (patch)
tree3d49449b2301ad0a47244ee0a91abab28f3961a7 /ash/wm
parent77c6b1908bfedaa7f91cda58fd17192ecca92c6c (diff)
downloadchromium_src-ad9a142a7f2cb9d93c17a0ab62600ea564ee9b2b.zip
chromium_src-ad9a142a7f2cb9d93c17a0ab62600ea564ee9b2b.tar.gz
chromium_src-ad9a142a7f2cb9d93c17a0ab62600ea564ee9b2b.tar.bz2
Remove obsolete checks of ash::wm::WindowState::tracked_by_workspace() in ash::HeaderPainter.
The checks can be removed because when a user drags a maximized browser window which has just one tab the window is now restored. (https://codereview.chromium.org/80323002) Review URL: https://codereview.chromium.org/100793003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238684 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm')
-rw-r--r--ash/wm/caption_buttons/frame_caption_button_container_view.cc5
-rw-r--r--ash/wm/custom_frame_view_ash.cc2
-rw-r--r--ash/wm/header_painter.cc38
-rw-r--r--ash/wm/header_painter.h27
-rw-r--r--ash/wm/header_painter_unittest.cc23
-rw-r--r--ash/wm/panels/panel_frame_view.cc5
6 files changed, 9 insertions, 91 deletions
diff --git a/ash/wm/caption_buttons/frame_caption_button_container_view.cc b/ash/wm/caption_buttons/frame_caption_button_container_view.cc
index 40708b8..0ed5d12 100644
--- a/ash/wm/caption_buttons/frame_caption_button_container_view.cc
+++ b/ash/wm/caption_buttons/frame_caption_button_container_view.cc
@@ -8,7 +8,6 @@
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/wm/caption_buttons/frame_maximize_button.h"
-#include "ash/wm/window_state.h"
#include "grit/ash_resources.h"
#include "grit/ui_strings.h" // Accessibility names
#include "ui/base/hit_test.h"
@@ -135,9 +134,7 @@ void FrameCaptionButtonContainerView::Layout() {
if (header_style_ == HEADER_STYLE_SHORT) {
// The new assets only make sense if the window is maximized or fullscreen
// because we usually use a black header in this case.
- if ((frame_->IsMaximized() || frame_->IsFullscreen()) &&
- wm::GetWindowState(
- frame_->GetNativeWindow())->tracked_by_workspace()) {
+ if (frame_->IsMaximized() || frame_->IsFullscreen()) {
SetButtonImages(size_button_,
IDR_AURA_WINDOW_MAXIMIZED_RESTORE2,
IDR_AURA_WINDOW_MAXIMIZED_RESTORE2_H,
diff --git a/ash/wm/custom_frame_view_ash.cc b/ash/wm/custom_frame_view_ash.cc
index ef2bc10..47a88bc 100644
--- a/ash/wm/custom_frame_view_ash.cc
+++ b/ash/wm/custom_frame_view_ash.cc
@@ -177,7 +177,7 @@ void CustomFrameViewAsh::HeaderView::Layout() {
void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) {
int theme_image_id = 0;
- if (header_painter_->ShouldUseMinimalHeaderStyle(HeaderPainter::THEMED_NO))
+ if (frame_->IsMaximized() || frame_->IsFullscreen())
theme_image_id = IDR_AURA_WINDOW_HEADER_BASE_MINIMAL;
else if (paint_as_active_)
theme_image_id = IDR_AURA_WINDOW_HEADER_BASE_ACTIVE;
diff --git a/ash/wm/header_painter.cc b/ash/wm/header_painter.cc
index ef24db3..bf87015 100644
--- a/ash/wm/header_painter.cc
+++ b/ash/wm/header_painter.cc
@@ -9,7 +9,6 @@
#include "ash/root_window_controller.h"
#include "ash/wm/caption_buttons/frame_caption_button_container_view.h"
#include "ash/wm/solo_window_tracker.h"
-#include "ash/wm/window_state.h"
#include "base/logging.h" // DCHECK
#include "grit/ash_resources.h"
#include "third_party/skia/include/core/SkCanvas.h"
@@ -165,10 +164,8 @@ HeaderPainter::HeaderPainter()
HeaderPainter::~HeaderPainter() {
// Sometimes we are destroyed before the window closes, so ensure we clean up.
- if (window_) {
+ if (window_)
window_->RemoveObserver(this);
- wm::GetWindowState(window_)->RemoveObserver(this);
- }
}
void HeaderPainter::Init(
@@ -203,7 +200,6 @@ void HeaderPainter::Init(
// Observer removes itself in OnWindowDestroying() below, or in the destructor
// if we go away before the window.
window_->AddObserver(this);
- wm::GetWindowState(window_)->AddObserver(this);
// Solo-window header updates are handled by the WorkspaceLayoutManager when
// this window is added to the desktop.
@@ -262,17 +258,6 @@ int HeaderPainter::GetThemeBackgroundXInset() const {
return kThemeFrameImageInsetX;
}
-bool HeaderPainter::ShouldUseMinimalHeaderStyle(Themed header_themed) const {
- // Use the minimalistic header style whenever |frame_| is maximized or
- // fullscreen EXCEPT:
- // - If the user has installed a theme with custom images for the header.
- // - For windows which are not tracked by the workspace code (which are used
- // for tab dragging).
- return (frame_->IsMaximized() || frame_->IsFullscreen()) &&
- header_themed == THEMED_NO &&
- wm::GetWindowState(frame_->GetNativeWindow())->tracked_by_workspace();
-}
-
void HeaderPainter::PaintHeader(gfx::Canvas* canvas,
HeaderMode header_mode,
int theme_frame_id,
@@ -489,16 +474,6 @@ void HeaderPainter::OnThemeChanged() {
}
///////////////////////////////////////////////////////////////////////////////
-// WindowStateObserver overrides:
-void HeaderPainter::OnTrackedByWorkspaceChanged(wm::WindowState* window_state,
- bool old) {
- // When 'TrackedByWorkspace' changes, we are going to paint the header
- // differently. Schedule a paint to ensure everything is updated correctly.
- if (window_state->tracked_by_workspace())
- header_view_->SchedulePaint();
-}
-
-///////////////////////////////////////////////////////////////////////////////
// aura::WindowObserver overrides:
void HeaderPainter::OnWindowDestroying(aura::Window* destroying) {
@@ -507,7 +482,6 @@ void HeaderPainter::OnWindowDestroying(aura::Window* destroying) {
// Must be removed here and not in the destructor, as the aura::Window is
// already destroyed when our destructor runs.
window_->RemoveObserver(this);
- wm::GetWindowState(window_)->RemoveObserver(this);
window_ = NULL;
}
@@ -550,11 +524,7 @@ int HeaderPainter::GetCaptionButtonContainerCenterY() const {
}
int HeaderPainter::GetHeaderCornerRadius() const {
- // Use square corners for maximized and fullscreen windows when they are
- // tracked by the workspace code. (Windows which are not tracked by the
- // workspace code are used for tab dragging.)
- bool square_corners = ((frame_->IsMaximized() || frame_->IsFullscreen())) &&
- wm::GetWindowState(frame_->GetNativeWindow())->tracked_by_workspace();
+ bool square_corners = (frame_->IsMaximized() || frame_->IsFullscreen());
const int kCornerRadius = 2;
return square_corners ? 0 : kCornerRadius;
}
@@ -571,8 +541,8 @@ int HeaderPainter::GetHeaderOpacity(
return kFullyOpaque;
}
- // The header is fully opaque when using the minimalistic header style.
- if (ShouldUseMinimalHeaderStyle(THEMED_NO))
+ // Maximized and fullscreen windows are fully opaque.
+ if (frame_->IsMaximized() || frame_->IsFullscreen())
return kFullyOpaque;
// Solo header is very transparent.
diff --git a/ash/wm/header_painter.h b/ash/wm/header_painter.h
index ea326af..1f4d013 100644
--- a/ash/wm/header_painter.h
+++ b/ash/wm/header_painter.h
@@ -6,7 +6,6 @@
#define ASH_WM_HEADER_PAINTER_H_
#include "ash/ash_export.h"
-#include "ash/wm/window_state_observer.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h" // OVERRIDE
#include "base/gtest_prod_util.h"
@@ -36,8 +35,7 @@ class FrameCaptionButtonContainerView;
// Helper class for painting the window header.
class ASH_EXPORT HeaderPainter : public aura::WindowObserver,
- public gfx::AnimationDelegate,
- public wm::WindowStateObserver {
+ public gfx::AnimationDelegate {
public:
// Opacity values for the window header in various states, from 0 to 255.
static int kActiveWindowOpacity;
@@ -49,11 +47,6 @@ class ASH_EXPORT HeaderPainter : public aura::WindowObserver,
INACTIVE
};
- enum Themed {
- THEMED_YES,
- THEMED_NO
- };
-
HeaderPainter();
virtual ~HeaderPainter();
@@ -92,9 +85,6 @@ class ASH_EXPORT HeaderPainter : public aura::WindowObserver,
// Returns the amount that the theme background should be inset.
int GetThemeBackgroundXInset() const;
- // Returns true if the header should be painted using a minimalistic style.
- bool ShouldUseMinimalHeaderStyle(Themed header_themed) const;
-
// Paints the header.
// |theme_frame_overlay_id| is 0 if no overlay image should be used.
void PaintHeader(gfx::Canvas* canvas,
@@ -136,27 +126,12 @@ class ASH_EXPORT HeaderPainter : public aura::WindowObserver,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE;
- // ash::WindowStateObserver override:
- virtual void OnTrackedByWorkspaceChanged(wm::WindowState* window_state,
- bool old) OVERRIDE;
-
// Overridden from gfx::AnimationDelegate
virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
private:
- FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest, CreateAndDeleteSingleWindow);
- FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest, UseSoloWindowHeader);
- FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest, UseSoloWindowHeaderWithApp);
- FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest, UseSoloWindowHeaderWithPanel);
- FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest, UseSoloWindowHeaderModal);
- FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest, UseSoloWindowHeaderConstrained);
- FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest, UseSoloWindowHeaderNotDrawn);
- FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest, UseSoloWindowHeaderMultiDisplay);
FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest, GetHeaderOpacity);
FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest, TitleIconAlignment);
- FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest, ChildWindowVisibility);
- FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest,
- NoCrashShutdownWithAlwaysOnTopWindow);
// Returns the header bounds in the coordinates of |header_view_|. The header
// is assumed to be positioned at the top left corner of |header_view_| and to
diff --git a/ash/wm/header_painter_unittest.cc b/ash/wm/header_painter_unittest.cc
index 551658a..8ce8917 100644
--- a/ash/wm/header_painter_unittest.cc
+++ b/ash/wm/header_painter_unittest.cc
@@ -123,29 +123,6 @@ TEST_F(HeaderPainterTest, GetHeaderOpacity) {
0));
}
-// Test that the minimal header style is used in the proper situations.
-TEST_F(HeaderPainterTest, MinimalHeaderStyle) {
- // Create a widget and a painter for it.
- scoped_ptr<Widget> w(CreateTestWidget());
- scoped_ptr<HeaderPainter> p(CreateTestPainter(w.get()));
- w->Show();
-
- // Regular non-maximized windows should not use the minimal header style.
- EXPECT_FALSE(p->ShouldUseMinimalHeaderStyle(HeaderPainter::THEMED_NO));
-
- // Regular maximized windows should use the minimal header style.
- w->Maximize();
- EXPECT_TRUE(p->ShouldUseMinimalHeaderStyle(HeaderPainter::THEMED_NO));
-
- // Test cases where the maximized window should not use the minimal header
- // style.
- EXPECT_FALSE(p->ShouldUseMinimalHeaderStyle(HeaderPainter::THEMED_YES));
-
- wm::GetWindowState(w->GetNativeWindow())->SetTrackedByWorkspace(false);
- EXPECT_FALSE(p->ShouldUseMinimalHeaderStyle(HeaderPainter::THEMED_NO));
- wm::GetWindowState(w->GetNativeWindow())->SetTrackedByWorkspace(true);
-}
-
// Ensure the title text is vertically aligned with the window icon.
TEST_F(HeaderPainterTest, TitleIconAlignment) {
scoped_ptr<Widget> w(CreateTestWidget());
diff --git a/ash/wm/panels/panel_frame_view.cc b/ash/wm/panels/panel_frame_view.cc
index bafe29f..3c01e52 100644
--- a/ash/wm/panels/panel_frame_view.cc
+++ b/ash/wm/panels/panel_frame_view.cc
@@ -29,6 +29,7 @@ PanelFrameView::PanelFrameView(views::Widget* frame, FrameType frame_type)
title_font_(gfx::Font(views::NativeWidgetAura::GetWindowTitleFont())),
frame_border_hit_test_controller_(
new FrameBorderHitTestController(frame_)) {
+ DCHECK(!frame_->widget_delegate()->CanMaximize());
if (frame_type != FRAME_NONE)
InitHeaderPainter();
}
@@ -115,9 +116,7 @@ void PanelFrameView::OnPaint(gfx::Canvas* canvas) {
return;
bool paint_as_active = ShouldPaintAsActive();
int theme_frame_id = 0;
- if (header_painter_->ShouldUseMinimalHeaderStyle(HeaderPainter::THEMED_NO))
- theme_frame_id = IDR_AURA_WINDOW_HEADER_BASE_MINIMAL;
- else if (paint_as_active)
+ if (paint_as_active)
theme_frame_id = IDR_AURA_WINDOW_HEADER_BASE_ACTIVE;
else
theme_frame_id = IDR_AURA_WINDOW_HEADER_BASE_INACTIVE;