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 #include "chrome/browser/android/compositor/tab_content_manager.h" | 5 #include "chrome/browser/android/compositor/tab_content_manager.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "cc/layers/layer.h" | 14 #include "cc/layers/layer.h" |
15 #include "chrome/browser/android/compositor/layer/thumbnail_layer.h" | 15 #include "chrome/browser/android/compositor/layer/thumbnail_layer.h" |
16 #include "chrome/browser/android/tab_android.h" | 16 #include "chrome/browser/android/tab_android.h" |
17 #include "chrome/browser/android/thumbnail/thumbnail.h" | 17 #include "chrome/browser/android/thumbnail/thumbnail.h" |
18 #include "content/public/browser/android/content_view_core.h" | 18 #include "content/public/browser/android/content_view_core.h" |
19 #include "content/public/browser/android/ui_resource_provider.h" | |
20 #include "content/public/browser/readback_types.h" | 19 #include "content/public/browser/readback_types.h" |
21 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
22 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
23 #include "jni/TabContentManager_jni.h" | 22 #include "jni/TabContentManager_jni.h" |
| 23 #include "ui/android/resources/ui_resource_provider.h" |
24 #include "ui/gfx/android/java_bitmap.h" | 24 #include "ui/gfx/android/java_bitmap.h" |
25 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
26 #include "url/gurl.h" | 26 #include "url/gurl.h" |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 const size_t kMaxReadbacks = 1; | 30 const size_t kMaxReadbacks = 1; |
31 typedef base::Callback<void(float, const SkBitmap&)> TabReadbackCallback; | 31 typedef base::Callback<void(float, const SkBitmap&)> TabReadbackCallback; |
32 | 32 |
33 } // namespace | 33 } // namespace |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 149 } |
150 | 150 |
151 void TabContentManager::Destroy(JNIEnv* env, jobject obj) { | 151 void TabContentManager::Destroy(JNIEnv* env, jobject obj) { |
152 thumbnail_cache_->RemoveThumbnailStoreObserver(this); | 152 thumbnail_cache_->RemoveThumbnailStoreObserver(this); |
153 delete this; | 153 delete this; |
154 } | 154 } |
155 | 155 |
156 void TabContentManager::SetUIResourceProvider(JNIEnv* env, | 156 void TabContentManager::SetUIResourceProvider(JNIEnv* env, |
157 jobject obj, | 157 jobject obj, |
158 jlong ui_resource_provider_ptr) { | 158 jlong ui_resource_provider_ptr) { |
159 content::UIResourceProvider* ui_resource_provider = | 159 ui::UIResourceProvider* ui_resource_provider = |
160 reinterpret_cast<content::UIResourceProvider*>(ui_resource_provider_ptr); | 160 reinterpret_cast<ui::UIResourceProvider*>(ui_resource_provider_ptr); |
161 SetUIResourceProvider(ui_resource_provider); | 161 SetUIResourceProvider(ui_resource_provider); |
162 } | 162 } |
163 | 163 |
164 void TabContentManager::SetUIResourceProvider( | 164 void TabContentManager::SetUIResourceProvider( |
165 content::UIResourceProvider* ui_resource_provider) { | 165 ui::UIResourceProvider* ui_resource_provider) { |
166 thumbnail_cache_->SetUIResourceProvider(ui_resource_provider); | 166 thumbnail_cache_->SetUIResourceProvider(ui_resource_provider); |
167 } | 167 } |
168 | 168 |
169 scoped_refptr<cc::Layer> TabContentManager::GetLiveLayer(int tab_id) { | 169 scoped_refptr<cc::Layer> TabContentManager::GetLiveLayer(int tab_id) { |
170 scoped_refptr<cc::Layer> layer = live_layer_list_[tab_id]; | 170 scoped_refptr<cc::Layer> layer = live_layer_list_[tab_id]; |
171 if (!layer.get()) | 171 if (!layer.get()) |
172 return NULL; | 172 return NULL; |
173 | 173 |
174 return layer; | 174 return layer; |
175 } | 175 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 jboolean use_approximation_thumbnail) { | 384 jboolean use_approximation_thumbnail) { |
385 TabContentManager* manager = new TabContentManager( | 385 TabContentManager* manager = new TabContentManager( |
386 env, obj, disk_cache_path, default_cache_size, approximation_cache_size, | 386 env, obj, disk_cache_path, default_cache_size, approximation_cache_size, |
387 compression_queue_max_size, write_queue_max_size, | 387 compression_queue_max_size, write_queue_max_size, |
388 use_approximation_thumbnail); | 388 use_approximation_thumbnail); |
389 return reinterpret_cast<intptr_t>(manager); | 389 return reinterpret_cast<intptr_t>(manager); |
390 } | 390 } |
391 | 391 |
392 } // namespace android | 392 } // namespace android |
393 } // namespace chrome | 393 } // namespace chrome |
OLD | NEW |