| 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/decoration_title.h" | 5 #include "chrome/browser/android/compositor/decoration_title.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "cc/layers/layer.h" | 11 #include "cc/layers/layer.h" |
| 12 #include "cc/layers/ui_resource_layer.h" | 12 #include "cc/layers/ui_resource_layer.h" |
| 13 #include "cc/resources/scoped_ui_resource.h" | 13 #include "cc/resources/scoped_ui_resource.h" |
| 14 #include "chrome/browser/android/compositor/layer_title_cache.h" | |
| 15 #include "content/public/browser/android/compositor.h" | 14 #include "content/public/browser/android/compositor.h" |
| 16 #include "ui/android/resources/resource_manager.h" | 15 #include "ui/android/resources/resource_manager.h" |
| 17 #include "ui/base/l10n/l10n_util_android.h" | 16 #include "ui/base/l10n/l10n_util_android.h" |
| 18 #include "ui/gfx/android/java_bitmap.h" | 17 #include "ui/gfx/android/java_bitmap.h" |
| 19 #include "ui/gfx/geometry/vector3d_f.h" | 18 #include "ui/gfx/geometry/vector3d_f.h" |
| 20 | 19 |
| 21 namespace chrome { | 20 namespace chrome { |
| 22 namespace android { | 21 namespace android { |
| 23 | 22 |
| 24 DecorationTitle::DecorationTitle(LayerTitleCache* layer_title_cache, | 23 DecorationTitle::DecorationTitle(ui::ResourceManager* resource_manager, |
| 25 ui::ResourceManager* resource_manager, | |
| 26 int title_resource_id, | 24 int title_resource_id, |
| 27 int favicon_resource_id, | 25 int favicon_resource_id, |
| 28 int spinner_resource_id, | 26 int spinner_resource_id, |
| 29 int spinner_incognito_resource_id, | 27 int spinner_incognito_resource_id, |
| 30 int fade_width, | 28 int fade_width, |
| 31 int favicon_start_padding, | 29 int favicon_start_padding, |
| 32 int favicon_end_padding, | 30 int favicon_end_padding, |
| 33 bool is_incognito, | 31 bool is_incognito, |
| 34 bool is_rtl) | 32 bool is_rtl) |
| 35 : layer_(cc::Layer::Create()), | 33 : layer_(cc::Layer::Create()), |
| 36 layer_opaque_(cc::UIResourceLayer::Create()), | 34 layer_opaque_(cc::UIResourceLayer::Create()), |
| 37 layer_fade_(cc::UIResourceLayer::Create()), | 35 layer_fade_(cc::UIResourceLayer::Create()), |
| 38 layer_favicon_(cc::UIResourceLayer::Create()), | 36 layer_favicon_(cc::UIResourceLayer::Create()), |
| 39 title_resource_id_(title_resource_id), | 37 title_resource_id_(title_resource_id), |
| 40 favicon_resource_id_(favicon_resource_id), | 38 favicon_resource_id_(favicon_resource_id), |
| 41 spinner_resource_id_(spinner_resource_id), | 39 spinner_resource_id_(spinner_resource_id), |
| 42 spinner_incognito_resource_id_(spinner_incognito_resource_id), | 40 spinner_incognito_resource_id_(spinner_incognito_resource_id), |
| 43 fade_width_(fade_width), | 41 fade_width_(fade_width), |
| 44 spinner_rotation_(0), | 42 spinner_rotation_(0), |
| 45 favicon_start_padding_(favicon_start_padding), | 43 favicon_start_padding_(favicon_start_padding), |
| 46 favicon_end_padding_(favicon_end_padding), | 44 favicon_end_padding_(favicon_end_padding), |
| 47 is_incognito_(is_incognito), | 45 is_incognito_(is_incognito), |
| 48 is_rtl_(is_rtl), | 46 is_rtl_(is_rtl), |
| 49 is_loading_(false), | 47 is_loading_(false), |
| 50 transform_(new gfx::Transform()), | 48 transform_(new gfx::Transform()), |
| 51 resource_manager_(resource_manager), | 49 resource_manager_(resource_manager) { |
| 52 layer_title_cache_(layer_title_cache) { | |
| 53 layer_->AddChild(layer_favicon_); | 50 layer_->AddChild(layer_favicon_); |
| 54 layer_->AddChild(layer_opaque_); | 51 layer_->AddChild(layer_opaque_); |
| 55 layer_->AddChild(layer_fade_); | 52 layer_->AddChild(layer_fade_); |
| 56 } | 53 } |
| 57 | 54 |
| 58 DecorationTitle::~DecorationTitle() { | 55 DecorationTitle::~DecorationTitle() { |
| 59 layer_->RemoveFromParent(); | 56 layer_->RemoveFromParent(); |
| 60 } | 57 } |
| 61 | 58 |
| 62 void DecorationTitle::SetResourceManager( | 59 void DecorationTitle::SetResourceManager( |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 236 } |
| 240 } | 237 } |
| 241 | 238 |
| 242 scoped_refptr<cc::Layer> DecorationTitle::layer() { | 239 scoped_refptr<cc::Layer> DecorationTitle::layer() { |
| 243 DCHECK(layer_.get()); | 240 DCHECK(layer_.get()); |
| 244 return layer_; | 241 return layer_; |
| 245 } | 242 } |
| 246 | 243 |
| 247 } // namespace android | 244 } // namespace android |
| 248 } // namespace chrome | 245 } // namespace chrome |
| OLD | NEW |