Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: athena/activity/public/activity_view_model.h

Issue 358003002: Additions to Activities to allow resource management (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 {
14 class ImageSkia;
15 }
16
13 namespace views { 17 namespace views {
14 class View; 18 class View;
15 } 19 }
16 20
17 namespace athena { 21 namespace athena {
18 22
23 // The view model for the representation of the activity.
19 class ATHENA_EXPORT ActivityViewModel { 24 class ATHENA_EXPORT ActivityViewModel {
20 public: 25 public:
21 virtual ~ActivityViewModel() {} 26 virtual ~ActivityViewModel() {}
22 27
23 // Called after the view model is attaced to the widget/window tree. 28 // Called after the view model is attached to the widget/window tree.
24 virtual void Init() = 0; 29 virtual void Init() = 0;
25 30
26 // Returns a color most representative of this activity. 31 // Returns a color most representative of this activity.
27 virtual SkColor GetRepresentativeColor() = 0; 32 virtual SkColor GetRepresentativeColor() = 0;
28 33
29 // Returns a title for the activity. 34 // Returns a title for the activity.
30 virtual base::string16 GetTitle() = 0; 35 virtual base::string16 GetTitle() = 0;
31 36
32 // Returns the contents view. 37 // Returns the contents view which might be NULL if the activity is not
38 // loaded. Note that the caller should not hold on to the view since it can
39 // be deleted by the resource manager.
33 virtual views::View* GetContentsView() = 0; 40 virtual views::View* GetContentsView() = 0;
41
42 // This gets called before the Activity gets (partially) thrown out of memory
43 // to create a preview image of the activity. Note that even if this function
44 // gets called, |GetOverviewModeImage()| could still return an empty image.
45 virtual void CreateOverviewModeImage() = 0;
oshima 2014/07/11 18:02:59 Since the actual behavior is undefined, how about
Mr4D (OOO till 08-26) 2014/07/11 22:38:08 In the question of "Prepare" vs. "create" I would
46
47 // Returns an image which can be used to represent the activity in e.g. the
48 // overview mode. The returned image can have no size if either a view exists
49 // or the activity has not yet been loaded. In that case
50 // GetRepresentativeColor() should be used to clear the preview area.
51 // Note: We intentionally do not use a layer / view for this.
52 virtual gfx::ImageSkia GetOverviewModeImage() = 0;
34 }; 53 };
35 54
36 } // namespace athena 55 } // namespace athena
37 56
38 #endif // ATHENA_ACTIVITY_PUBLIC_ACTIVITY_VIEW_MODEL_H_ 57 #endif // ATHENA_ACTIVITY_PUBLIC_ACTIVITY_VIEW_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698