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

Unified Diff: ash/common/frame/header_view.h

Issue 2248383003: Moves HeaderView into it's own .h/.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 4 years, 4 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/common/frame/custom_frame_view_ash.cc ('k') | ash/common/frame/header_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/frame/header_view.h
diff --git a/ash/common/frame/header_view.h b/ash/common/frame/header_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..5a56ee5b323a883b24081dae9f50c58ef67157b4
--- /dev/null
+++ b/ash/common/frame/header_view.h
@@ -0,0 +1,107 @@
+// Copyright 2016 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_COMMON_FRAME_HEADER_VIEW_H_
+#define ASH_COMMON_FRAME_HEADER_VIEW_H_
+
+#include <memory>
+
+#include "ash/ash_export.h"
+#include "ash/common/shell_observer.h"
+#include "ash/common/wm/immersive/wm_immersive_fullscreen_controller_delegate.h"
+#include "base/macros.h"
+#include "third_party/skia/include/core/SkColor.h"
+#include "ui/views/view.h"
+
+namespace views {
+class ImageView;
+class Widget;
+}
+
+namespace ash {
+
+class DefaultHeaderPainter;
+class FrameCaptionButtonContainerView;
+
+// View which paints the frame header (title, caption buttons...). It slides off
+// and on screen in immersive fullscreen.
+class ASH_EXPORT HeaderView : public views::View,
+ public WmImmersiveFullscreenControllerDelegate,
+ public ShellObserver {
+ public:
+ // |target_widget| is the widget that the caption buttons act on.
+ // |target_widget| is not necessarily the same as the widget the header is
+ // placed in. For example, in immersive fullscreen this view may be painted in
+ // a widget that slides in and out on top of the main app or browser window.
+ // However, clicking a caption button should act on the target widget.
+ explicit HeaderView(views::Widget* target_widget);
+ ~HeaderView() override;
+
+ // Schedules a repaint for the entire title.
+ void SchedulePaintForTitle();
+
+ // Tells the window controls to reset themselves to the normal state.
+ void ResetWindowControls();
+
+ // Returns the amount of the view's pixels which should be on screen.
+ int GetPreferredOnScreenHeight() const;
+
+ // Returns the view's preferred height.
+ int GetPreferredHeight() const;
+
+ // Returns the view's minimum width.
+ int GetMinimumWidth() const;
+
+ void UpdateAvatarIcon();
+
+ void SizeConstraintsChanged();
+
+ void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color);
+
+ // views::View:
+ void Layout() override;
+ void OnPaint(gfx::Canvas* canvas) override;
+ void ChildPreferredSizeChanged(views::View* child) override;
+
+ // ShellObserver:
+ void OnOverviewModeStarting() override;
+ void OnOverviewModeEnded() override;
+ void OnMaximizeModeStarted() override;
+ void OnMaximizeModeEnded() override;
+
+ FrameCaptionButtonContainerView* caption_button_container() {
+ return caption_button_container_;
+ }
+
+ views::View* avatar_icon() const;
+
+ private:
+ // WmImmersiveFullscreenControllerDelegate:
+ void OnImmersiveRevealStarted() override;
+ void OnImmersiveRevealEnded() override;
+ void OnImmersiveFullscreenExited() override;
+ void SetVisibleFraction(double visible_fraction) override;
+ std::vector<gfx::Rect> GetVisibleBoundsInScreen() const override;
+
+ // The widget that the caption buttons act on.
+ views::Widget* target_widget_;
+
+ // Helper for painting the header.
+ std::unique_ptr<DefaultHeaderPainter> header_painter_;
+
+ views::ImageView* avatar_icon_;
+
+ // View which contains the window caption buttons.
+ FrameCaptionButtonContainerView* caption_button_container_;
+
+ // The fraction of the header's height which is visible while in fullscreen.
+ // This value is meaningless when not in fullscreen.
+ double fullscreen_visible_fraction_;
+
+ DISALLOW_COPY_AND_ASSIGN(HeaderView);
+};
+
+} // namespace ash
+
+#endif // ASH_COMMON_FRAME_HEADER_VIEW_H_
« no previous file with comments | « ash/common/frame/custom_frame_view_ash.cc ('k') | ash/common/frame/header_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698