Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Unified Diff: ash/frame/default_header_painter.h

Issue 189463013: [Refactor] Move code for painting the window header for browser windows out of ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/frame/custom_frame_view_ash_unittest.cc ('k') | ash/frame/default_header_painter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/frame/default_header_painter.h
diff --git a/ash/frame/default_header_painter.h b/ash/frame/default_header_painter.h
new file mode 100644
index 0000000000000000000000000000000000000000..80990c143bdc3346ab05dba7a3c16370a0ad23ae
--- /dev/null
+++ b/ash/frame/default_header_painter.h
@@ -0,0 +1,94 @@
+// Copyright 2014 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.
+
+#ifndef ASH_FRAME_DEFAULT_HEADER_PAINTER_H_
+#define ASH_FRAME_DEFAULT_HEADER_PAINTER_H_
+
+#include "ash/ash_export.h"
+#include "ash/frame/header_painter.h"
+#include "base/basictypes.h"
+#include "base/compiler_specific.h" // OVERRIDE
+#include "base/gtest_prod_util.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/gfx/animation/animation_delegate.h"
+
+namespace gfx {
+class Rect;
+class SlideAnimation;
+}
+namespace views {
+class View;
+class Widget;
+}
+
+namespace ash {
+class FrameCaptionButtonContainerView;
+
+// Helper class for painting the default window header.
+class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter,
+ public gfx::AnimationDelegate {
+ public:
+ DefaultHeaderPainter();
+ virtual ~DefaultHeaderPainter();
+
+ // DefaultHeaderPainter does not take ownership of any of the parameters.
+ void Init(views::Widget* frame,
+ views::View* header_view,
+ views::View* window_icon,
+ FrameCaptionButtonContainerView* caption_button_container);
+
+ // HeaderPainter overrides:
+ virtual int GetMinimumHeaderWidth() const OVERRIDE;
+ virtual void PaintHeader(gfx::Canvas* canvas, Mode mode) OVERRIDE;
+ virtual void LayoutHeader() OVERRIDE;
+ virtual int GetHeaderHeightForPainting() const OVERRIDE;
+ virtual void SetHeaderHeightForPainting(int height) OVERRIDE;
+ virtual void SchedulePaintForTitle() OVERRIDE;
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, TitleIconAlignment);
+
+ // gfx::AnimationDelegate override:
+ virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
+
+ // Paints highlight around the edge of the header for inactive restored
+ // windows.
+ void PaintHighlightForInactiveRestoredWindow(gfx::Canvas* canvas);
+
+ // Paints the title bar, primarily the title string.
+ void PaintTitleBar(gfx::Canvas* canvas);
+
+ // Paints the header/content separator.
+ void PaintHeaderContentSeparator(gfx::Canvas* canvas);
+
+ // Returns the header bounds in the coordinates of |view_|. The header is
+ // assumed to be positioned at the top left corner of |view_| and to have the
+ // same width as |view_|.
+ gfx::Rect GetLocalBounds() const;
+
+ // Returns the bounds for the title.
+ gfx::Rect GetTitleBounds() const;
+
+ views::Widget* frame_;
+ views::View* view_;
+ views::View* window_icon_; // May be NULL.
+ FrameCaptionButtonContainerView* caption_button_container_;
+
+ // The height of the header including the header/content separator.
+ int height_;
+
+ // Whether the header should be painted as active.
+ Mode mode_;
+
+ // Whether the header is painted for the first time.
+ bool initial_paint_;
+
+ scoped_ptr<gfx::SlideAnimation> activation_animation_;
+
+ DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter);
+};
+
+} // namespace ash
+
+#endif // ASH_FRAME_DEFAULT_HEADER_PAINTER_H_
« no previous file with comments | « ash/frame/custom_frame_view_ash_unittest.cc ('k') | ash/frame/default_header_painter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698