| 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 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 if (title_resource_id != -1 && favicon_resource_id != -1) { | 70 if (title_resource_id != -1 && favicon_resource_id != -1) { |
| 71 title_layer->Update(title_resource_id, favicon_resource_id, fade_width_, | 71 title_layer->Update(title_resource_id, favicon_resource_id, fade_width_, |
| 72 favicon_start_padding_, favicon_end_padding_, | 72 favicon_start_padding_, favicon_end_padding_, |
| 73 is_incognito, is_rtl); | 73 is_incognito, is_rtl); |
| 74 } else { | 74 } else { |
| 75 layer_cache_.Remove(tab_id); | 75 layer_cache_.Remove(tab_id); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 void LayerTitleCache::UpdateTitleForTab(int tab_id, int theme_color) { |
| 81 JNIEnv* env = base::android::AttachCurrentThread(); |
| 82 Java_LayerTitleCache_buildUpdatedTitle(env, weak_java_title_cache_.get(env), |
| 83 tab_id, theme_color); |
| 84 } |
| 85 |
| 80 void LayerTitleCache::UpdateFavicon(JNIEnv* env, | 86 void LayerTitleCache::UpdateFavicon(JNIEnv* env, |
| 81 const JavaParamRef<jobject>& obj, | 87 const JavaParamRef<jobject>& obj, |
| 82 jint tab_id, | 88 jint tab_id, |
| 83 jint favicon_resource_id) { | 89 jint favicon_resource_id) { |
| 84 DecorationTitle* title_layer = layer_cache_.Lookup(tab_id); | 90 DecorationTitle* title_layer = layer_cache_.Lookup(tab_id); |
| 85 if (title_layer == nullptr && favicon_resource_id != -1) { | 91 if (title_layer == nullptr && favicon_resource_id != -1) { |
| 86 title_layer->SetFaviconResourceId(favicon_resource_id); | 92 title_layer->SetFaviconResourceId(favicon_resource_id); |
| 87 } | 93 } |
| 88 } | 94 } |
| 89 | 95 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 jint spinner_resource_id, | 137 jint spinner_resource_id, |
| 132 jint spinner_incognito_resource_id) { | 138 jint spinner_incognito_resource_id) { |
| 133 LayerTitleCache* cache = new LayerTitleCache( | 139 LayerTitleCache* cache = new LayerTitleCache( |
| 134 env, obj, fade_width, favicon_start_padding, favicon_end_padding, | 140 env, obj, fade_width, favicon_start_padding, favicon_end_padding, |
| 135 spinner_resource_id, spinner_incognito_resource_id); | 141 spinner_resource_id, spinner_incognito_resource_id); |
| 136 return reinterpret_cast<intptr_t>(cache); | 142 return reinterpret_cast<intptr_t>(cache); |
| 137 } | 143 } |
| 138 | 144 |
| 139 } // namespace android | 145 } // namespace android |
| 140 } // namespace chrome | 146 } // namespace chrome |
| OLD | NEW |