• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef ATHENA_ACTIVITY_ACTIVITY_FRAME_VIEW_H_
6 #define ATHENA_ACTIVITY_ACTIVITY_FRAME_VIEW_H_
7 
8 #include "athena/wm/public/window_manager_observer.h"
9 #include "ui/gfx/insets.h"
10 #include "ui/views/window/non_client_view.h"
11 
12 namespace views {
13 class ImageView;
14 class Label;
15 class Widget;
16 }
17 
18 namespace athena {
19 
20 class ActivityViewModel;
21 
22 // A NonClientFrameView used for activity.
23 class ActivityFrameView : public views::NonClientFrameView,
24                           public WindowManagerObserver {
25  public:
26   // The frame class name.
27   static const char kViewClassName[];
28 
29   ActivityFrameView(views::Widget* frame, ActivityViewModel* view_model);
30   virtual ~ActivityFrameView();
31 
32   // views::NonClientFrameView:
33   virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
34   virtual gfx::Rect GetWindowBoundsForClientBounds(
35       const gfx::Rect& client_bounds) const OVERRIDE;
36   virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
37   virtual void GetWindowMask(const gfx::Size& size,
38                              gfx::Path* window_mask) OVERRIDE;
39   virtual void ResetWindowControls() OVERRIDE;
40   virtual void UpdateWindowIcon() OVERRIDE;
41   virtual void UpdateWindowTitle() OVERRIDE;
42   virtual void SizeConstraintsChanged() OVERRIDE;
43 
44   // views::View:
45   virtual gfx::Size GetPreferredSize() const OVERRIDE;
46   virtual const char* GetClassName() const OVERRIDE;
47   virtual void Layout() OVERRIDE;
48   virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE;
49 
50  private:
51   // WindowManagerObserver:
52   virtual void OnOverviewModeEnter() OVERRIDE;
53   virtual void OnOverviewModeExit() OVERRIDE;
54   virtual void OnSplitViewModeEnter() OVERRIDE;
55   virtual void OnSplitViewModeExit() OVERRIDE;
56 
57   gfx::Insets NonClientBorderInsets() const;
58   int NonClientBorderThickness() const;
59   int NonClientTopBorderHeight() const;
60 
61   // Not owned.
62   views::Widget* frame_;
63   ActivityViewModel* view_model_;
64   views::Label* title_;
65   views::ImageView* icon_;
66 
67   // Whether overview mode is active.
68   bool in_overview_;
69 
70   DISALLOW_COPY_AND_ASSIGN(ActivityFrameView);
71 };
72 
73 }  // namespace athena
74 
75 #endif  // ATHENA_ACTIVITY_ACTIVITY_FRAME_VIEW_H_
76