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 "content/public/browser/readback_types.h" |
12 #include "ui/gfx/image/image_skia.h" | 13 #include "ui/gfx/image/image_skia.h" |
13 | 14 |
14 namespace views { | 15 namespace views { |
15 class WebView; | 16 class WebView; |
16 } | 17 } |
17 | 18 |
18 namespace athena { | 19 namespace athena { |
19 | 20 |
20 class ProxyImageData; | 21 class ProxyImageData; |
21 | 22 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // MakeVisible. | 64 // MakeVisible. |
64 void HideOriginalContent(); | 65 void HideOriginalContent(); |
65 | 66 |
66 // Creates proxy content from |web_view_|. | 67 // Creates proxy content from |web_view_|. |
67 void CreateProxyContent(); | 68 void CreateProxyContent(); |
68 | 69 |
69 // Creates an image from the current content. | 70 // Creates an image from the current content. |
70 bool CreateContentImage(); | 71 bool CreateContentImage(); |
71 | 72 |
72 // Called once the content was read back. | 73 // Called once the content was read back. |
73 void OnContentImageRead(bool success, const SkBitmap& bitmap); | 74 void OnContentImageRead(const SkBitmap& bitmap, |
| 75 const content::ReadbackResponse& response); |
74 | 76 |
75 // Called once the image content has been converted to PNG. | 77 // Called once the image content has been converted to PNG. |
76 void OnContentImageEncodeComplete(scoped_refptr<ProxyImageData> image); | 78 void OnContentImageEncodeComplete(scoped_refptr<ProxyImageData> image); |
77 | 79 |
78 // The web view which was passed on creation and is associated with this | 80 // The web view which was passed on creation and is associated with this |
79 // object. It will be shown when OnPreContentDestroyed() gets called and then | 81 // object. It will be shown when OnPreContentDestroyed() gets called and then |
80 // set to nullptr. The ownership remains with the creator. | 82 // set to nullptr. The ownership remains with the creator. |
81 views::WebView* web_view_; | 83 views::WebView* web_view_; |
82 | 84 |
83 // While we are doing our PNG encode, we keep the read back image to have | 85 // While we are doing our PNG encode, we keep the read back image to have |
(...skipping 20 matching lines...) Expand all Loading... |
104 // weakptr for the callback to make sure that the read back / encoding image | 106 // weakptr for the callback to make sure that the read back / encoding image |
105 // completion callback does not trigger on a destroyed ContentProxy. | 107 // completion callback does not trigger on a destroyed ContentProxy. |
106 base::WeakPtrFactory<ContentProxy> proxy_content_to_image_factory_; | 108 base::WeakPtrFactory<ContentProxy> proxy_content_to_image_factory_; |
107 | 109 |
108 DISALLOW_COPY_AND_ASSIGN(ContentProxy); | 110 DISALLOW_COPY_AND_ASSIGN(ContentProxy); |
109 }; | 111 }; |
110 | 112 |
111 } // namespace athena | 113 } // namespace athena |
112 | 114 |
113 #endif // ATHENA_CONTENT_CONTENT_PROXY_H_ | 115 #endif // ATHENA_CONTENT_CONTENT_PROXY_H_ |
OLD | NEW |