| 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 class Widget; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace athena { | 22 namespace athena { |
| 23 | 23 |
| 24 class ActivityView; |
| 25 |
| 24 // The view model for the representation of the activity. | 26 // The view model for the representation of the activity. |
| 25 class ATHENA_EXPORT ActivityViewModel { | 27 class ATHENA_EXPORT ActivityViewModel { |
| 26 public: | 28 public: |
| 27 virtual ~ActivityViewModel() {} | 29 virtual ~ActivityViewModel() {} |
| 28 | 30 |
| 29 // Called after the view model is attached to the widget/window tree and | 31 // Called after the view model is attached to the widget/window tree and |
| 30 // before it gets registered to the ActivityManager and the ResourceManager. | 32 // before it gets registered to the ActivityManager and the ResourceManager. |
| 31 // At this time the Activity can also be moved to a different place in the | 33 // At this time the Activity can also be moved to a different place in the |
| 32 // Activity history. | 34 // Activity history. |
| 33 virtual void Init() = 0; | 35 virtual void Init() = 0; |
| 34 | 36 |
| 35 // Returns a color most representative of this activity. | 37 // Returns a color most representative of this activity. |
| 36 virtual SkColor GetRepresentativeColor() const = 0; | 38 virtual SkColor GetRepresentativeColor() const = 0; |
| 37 | 39 |
| 38 // Returns a title for the activity. | 40 // Returns a title for the activity. |
| 39 virtual base::string16 GetTitle() const = 0; | 41 virtual base::string16 GetTitle() const = 0; |
| 40 | 42 |
| 41 // Returns an icon for the activity. | 43 // Returns an icon for the activity. |
| 42 virtual gfx::ImageSkia GetIcon() const = 0; | 44 virtual gfx::ImageSkia GetIcon() const = 0; |
| 43 | 45 |
| 46 // Sets the ActivityView for the model to update. The model does not take |
| 47 // ownership of the view. |
| 48 virtual void SetActivityView(ActivityView* view) = 0; |
| 49 |
| 44 // True if the activity wants to use Widget's frame, or false if the activity | 50 // True if the activity wants to use Widget's frame, or false if the activity |
| 45 // draws its own frame. | 51 // draws its own frame. |
| 46 virtual bool UsesFrame() const = 0; | 52 virtual bool UsesFrame() const = 0; |
| 47 | 53 |
| 48 // Returns the contents view which might be nullptr if the activity is not | 54 // Returns the contents view which might be nullptr if the activity is not |
| 49 // loaded. Note that the caller should not hold on to the view since it can | 55 // loaded. Note that the caller should not hold on to the view since it can |
| 50 // be deleted by the resource manager. | 56 // be deleted by the resource manager. |
| 51 virtual views::View* GetContentsView() = 0; | 57 virtual views::View* GetContentsView() = 0; |
| 52 | 58 |
| 53 // 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 |
| 54 // 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 |
| 55 // or the activity has not yet been loaded or ever been presented. In that | 61 // or the activity has not yet been loaded or ever been presented. In that |
| 56 // case GetRepresentativeColor() should be used to clear the preview area. | 62 // case GetRepresentativeColor() should be used to clear the preview area. |
| 57 // Note that since the image gets created upon request, and the | 63 // Note that since the image gets created upon request, and the |
| 58 // ActivityViewModel will hold no reference to the returned image data. As | 64 // ActivityViewModel will hold no reference to the returned image data. As |
| 59 // such it is advisable to hold on to the image as long as needed instead of | 65 // such it is advisable to hold on to the image as long as needed instead of |
| 60 // calling this function frequently since it will cause time to generate. | 66 // calling this function frequently since it will cause time to generate. |
| 61 virtual gfx::ImageSkia GetOverviewModeImage() = 0; | 67 virtual gfx::ImageSkia GetOverviewModeImage() = 0; |
| 62 | 68 |
| 63 // Prepares the contents view for overview. | 69 // Prepares the contents view for overview. |
| 64 virtual void PrepareContentsForOverview() = 0; | 70 virtual void PrepareContentsForOverview() = 0; |
| 65 | 71 |
| 66 // Undoes any changes done by PrepareContentsForOverview(). | 72 // Undoes any changes done by PrepareContentsForOverview(). |
| 67 virtual void ResetContentsView() = 0; | 73 virtual void ResetContentsView() = 0; |
| 68 }; | 74 }; |
| 69 | 75 |
| 70 } // namespace athena | 76 } // namespace athena |
| 71 | 77 |
| 72 #endif // ATHENA_ACTIVITY_PUBLIC_ACTIVITY_VIEW_MODEL_H_ | 78 #endif // ATHENA_ACTIVITY_PUBLIC_ACTIVITY_VIEW_MODEL_H_ |
| OLD | NEW |