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_PUBLIC_ACTIVITY_VIEW_MODEL_H_ | 5 #ifndef ATHENA_ACTIVITY_PUBLIC_ACTIVITY_VIEW_MODEL_H_ |
6 #define ATHENA_ACTIVITY_PUBLIC_ACTIVITY_VIEW_MODEL_H_ | 6 #define ATHENA_ACTIVITY_PUBLIC_ACTIVITY_VIEW_MODEL_H_ |
7 | 7 |
8 #include "athena/athena_export.h" | 8 #include "athena/athena_export.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 | 10 |
11 typedef unsigned int SkColor; | 11 typedef unsigned int SkColor; |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class ImageSkia; | 14 class ImageSkia; |
15 } | 15 } |
16 | 16 |
17 namespace views { | 17 namespace views { |
18 class View; | 18 class View; |
| 19 class Widget; |
19 } | 20 } |
20 | 21 |
21 namespace athena { | 22 namespace athena { |
22 | 23 |
23 // The view model for the representation of the activity. | 24 // The view model for the representation of the activity. |
24 class ATHENA_EXPORT ActivityViewModel { | 25 class ATHENA_EXPORT ActivityViewModel { |
25 public: | 26 public: |
26 virtual ~ActivityViewModel() {} | 27 virtual ~ActivityViewModel() {} |
27 | 28 |
28 // Called after the view model is attached to the widget/window tree and | 29 // Called after the view model is attached to the widget/window tree and |
(...skipping 10 matching lines...) Expand all Loading... |
39 | 40 |
40 // True if the activity wants to use Widget's frame, or false if the activity | 41 // True if the activity wants to use Widget's frame, or false if the activity |
41 // draws its own frame. | 42 // draws its own frame. |
42 virtual bool UsesFrame() const = 0; | 43 virtual bool UsesFrame() const = 0; |
43 | 44 |
44 // Returns the contents view which might be NULL if the activity is not | 45 // Returns the contents view which might be NULL if the activity is not |
45 // loaded. Note that the caller should not hold on to the view since it can | 46 // loaded. Note that the caller should not hold on to the view since it can |
46 // be deleted by the resource manager. | 47 // be deleted by the resource manager. |
47 virtual views::View* GetContentsView() = 0; | 48 virtual views::View* GetContentsView() = 0; |
48 | 49 |
| 50 // Creates a custom widget for the activity. Returns NULL to use default |
| 51 // implementation. |
| 52 virtual views::Widget* CreateWidget() = 0; |
| 53 |
49 // This gets called before the Activity gets (partially) thrown out of memory | 54 // This gets called before the Activity gets (partially) thrown out of memory |
50 // to create a preview image of the activity. Note that even if this function | 55 // to create a preview image of the activity. Note that even if this function |
51 // gets called, |GetOverviewModeImage()| could still return an empty image. | 56 // gets called, |GetOverviewModeImage()| could still return an empty image. |
52 virtual void CreateOverviewModeImage() = 0; | 57 virtual void CreateOverviewModeImage() = 0; |
53 | 58 |
54 // Returns an image which can be used to represent the activity in e.g. the | 59 // Returns an image which can be used to represent the activity in e.g. the |
55 // overview mode. The returned image can have no size if either a view exists | 60 // overview mode. The returned image can have no size if either a view exists |
56 // or the activity has not yet been loaded. In that case | 61 // or the activity has not yet been loaded. In that case |
57 // GetRepresentativeColor() should be used to clear the preview area. | 62 // GetRepresentativeColor() should be used to clear the preview area. |
58 // Note: We intentionally do not use a layer / view for this. | 63 // Note: We intentionally do not use a layer / view for this. |
59 virtual gfx::ImageSkia GetOverviewModeImage() = 0; | 64 virtual gfx::ImageSkia GetOverviewModeImage() = 0; |
60 | 65 |
61 // Prepares the contents view for overview. | 66 // Prepares the contents view for overview. |
62 virtual void PrepareContentsForOverview() = 0; | 67 virtual void PrepareContentsForOverview() = 0; |
63 | 68 |
64 // Undoes any changes done by PrepareContentsForOverview(). | 69 // Undoes any changes done by PrepareContentsForOverview(). |
65 virtual void ResetContentsView() = 0; | 70 virtual void ResetContentsView() = 0; |
66 }; | 71 }; |
67 | 72 |
68 } // namespace athena | 73 } // namespace athena |
69 | 74 |
70 #endif // ATHENA_ACTIVITY_PUBLIC_ACTIVITY_VIEW_MODEL_H_ | 75 #endif // ATHENA_ACTIVITY_PUBLIC_ACTIVITY_VIEW_MODEL_H_ |
OLD | NEW |