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