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_CONTENT_CONTENT_PROXY_H_ | 5 #ifndef ATHENA_CONTENT_CONTENT_PROXY_H_ |
6 #define ATHENA_CONTENT_CONTENT_PROXY_H_ | 6 #define ATHENA_CONTENT_CONTENT_PROXY_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "ui/gfx/image/image_skia.h" | 12 #include "ui/gfx/image/image_skia.h" |
13 | 13 |
14 namespace views { | 14 namespace views { |
15 class WebView; | 15 class WebView; |
16 } | 16 } |
17 | 17 |
18 namespace athena { | 18 namespace athena { |
19 | 19 |
20 class Activity; | |
21 class ProxyImageData; | 20 class ProxyImageData; |
22 | 21 |
23 // This object creates and holds proxy content which gets shown instead of the | 22 // This object creates and holds proxy content which gets shown instead of the |
24 // actual web content, generated from the passed |web_view|. | 23 // actual web content, generated from the passed |web_view|. |
25 // The created |proxy_content_| will be destroyed with the destruction of this | 24 // The created |proxy_content_| will be destroyed with the destruction of this |
26 // object. | 25 // object. |
27 // Calling EvictContent() will release the rendered content. | 26 // Calling EvictContent() will release the rendered content. |
28 // When ContentGetsDestroyed() gets called, the old view will be made visible | 27 // When ContentGetsDestroyed() gets called, the old view will be made visible |
29 // and then the link to the |web_view_| will get severed. | 28 // and then the link to the |web_view_| will get severed. |
30 class ContentProxy { | 29 class ContentProxy { |
31 public: | 30 public: |
32 // Creates the object by creating a sized down |web_view| layer and making it | 31 // Creates the object by creating a sized down |web_view| layer. |
33 // visible inside |activity|'s window. | 32 explicit ContentProxy(views::WebView* web_view); |
34 ContentProxy(views::WebView* web_view, Activity* activity); | |
35 // TODO(skuhne): Add a function to create this object from a passed PNG, so | 33 // TODO(skuhne): Add a function to create this object from a passed PNG, so |
36 // that we can create it from a session restore. | 34 // that we can create it from a session restore. |
37 | 35 |
38 // With the destruction of the object, the layer should get destroyed and the | 36 // With the destruction of the object, the layer should get destroyed and the |
39 // content should become visible again. | 37 // content should become visible again. |
40 virtual ~ContentProxy(); | 38 virtual ~ContentProxy(); |
41 | 39 |
42 // Called when the content will get unloaded. | 40 // Called when the content will get unloaded. |
43 void ContentWillUnload(); | 41 void ContentWillUnload(); |
44 | 42 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // weakptr for the callback to make sure that the read back / encoding image | 104 // weakptr for the callback to make sure that the read back / encoding image |
107 // completion callback does not trigger on a destroyed ContentProxy. | 105 // completion callback does not trigger on a destroyed ContentProxy. |
108 base::WeakPtrFactory<ContentProxy> proxy_content_to_image_factory_; | 106 base::WeakPtrFactory<ContentProxy> proxy_content_to_image_factory_; |
109 | 107 |
110 DISALLOW_COPY_AND_ASSIGN(ContentProxy); | 108 DISALLOW_COPY_AND_ASSIGN(ContentProxy); |
111 }; | 109 }; |
112 | 110 |
113 } // namespace athena | 111 } // namespace athena |
114 | 112 |
115 #endif // ATHENA_CONTENT_CONTENT_PROXY_H_ | 113 #endif // ATHENA_CONTENT_CONTENT_PROXY_H_ |
OLD | NEW |