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