| 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/layer_title_cache.h" | 5 #include "chrome/browser/android/compositor/layer_title_cache.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/memory/ptr_util.h" |
| 11 #include "cc/layers/layer.h" | 12 #include "cc/layers/layer.h" |
| 12 #include "cc/layers/ui_resource_layer.h" | 13 #include "cc/layers/ui_resource_layer.h" |
| 13 #include "chrome/browser/android/compositor/decoration_title.h" | 14 #include "chrome/browser/android/compositor/decoration_title.h" |
| 14 #include "jni/LayerTitleCache_jni.h" | 15 #include "jni/LayerTitleCache_jni.h" |
| 15 #include "ui/android/resources/resource_manager.h" | 16 #include "ui/android/resources/resource_manager.h" |
| 16 #include "ui/gfx/android/java_bitmap.h" | 17 #include "ui/gfx/android/java_bitmap.h" |
| 17 #include "ui/gfx/geometry/point_f.h" | 18 #include "ui/gfx/geometry/point_f.h" |
| 18 #include "ui/gfx/geometry/rect_f.h" | 19 #include "ui/gfx/geometry/rect_f.h" |
| 19 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
| 20 | 21 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 if (title_layer) { | 62 if (title_layer) { |
| 62 if (title_resource_id != -1 && favicon_resource_id != -1) { | 63 if (title_resource_id != -1 && favicon_resource_id != -1) { |
| 63 title_layer->Update(title_resource_id, favicon_resource_id, fade_width_, | 64 title_layer->Update(title_resource_id, favicon_resource_id, fade_width_, |
| 64 favicon_start_padding_, favicon_end_padding_, | 65 favicon_start_padding_, favicon_end_padding_, |
| 65 is_incognito, is_rtl); | 66 is_incognito, is_rtl); |
| 66 } else { | 67 } else { |
| 67 layer_cache_.Remove(tab_id); | 68 layer_cache_.Remove(tab_id); |
| 68 } | 69 } |
| 69 } else { | 70 } else { |
| 70 layer_cache_.AddWithID( | 71 layer_cache_.AddWithID( |
| 71 new DecorationTitle( | 72 base::MakeUnique<DecorationTitle>( |
| 72 resource_manager_, title_resource_id, favicon_resource_id, | 73 resource_manager_, title_resource_id, favicon_resource_id, |
| 73 spinner_resource_id_, spinner_incognito_resource_id_, fade_width_, | 74 spinner_resource_id_, spinner_incognito_resource_id_, fade_width_, |
| 74 favicon_start_padding_, favicon_end_padding_, is_incognito, is_rtl), | 75 favicon_start_padding_, favicon_end_padding_, is_incognito, is_rtl), |
| 75 tab_id); | 76 tab_id); |
| 76 } | 77 } |
| 77 } | 78 } |
| 78 | 79 |
| 79 void LayerTitleCache::UpdateFavicon(JNIEnv* env, | 80 void LayerTitleCache::UpdateFavicon(JNIEnv* env, |
| 80 const JavaParamRef<jobject>& obj, | 81 const JavaParamRef<jobject>& obj, |
| 81 jint tab_id, | 82 jint tab_id, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 jint favicon_end_padding, | 136 jint favicon_end_padding, |
| 136 jint spinner_resource_id, | 137 jint spinner_resource_id, |
| 137 jint spinner_incognito_resource_id) { | 138 jint spinner_incognito_resource_id) { |
| 138 LayerTitleCache* cache = new LayerTitleCache( | 139 LayerTitleCache* cache = new LayerTitleCache( |
| 139 env, obj, fade_width, favicon_start_padding, favicon_end_padding, | 140 env, obj, fade_width, favicon_start_padding, favicon_end_padding, |
| 140 spinner_resource_id, spinner_incognito_resource_id); | 141 spinner_resource_id, spinner_incognito_resource_id); |
| 141 return reinterpret_cast<intptr_t>(cache); | 142 return reinterpret_cast<intptr_t>(cache); |
| 142 } | 143 } |
| 143 | 144 |
| 144 } // namespace android | 145 } // namespace android |
| OLD | NEW |