| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/reader_mode_layer.h" | 5 #include "chrome/browser/android/compositor/layer/reader_mode_layer.h" |
| 6 | 6 |
| 7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
| 8 #include "cc/resources/scoped_ui_resource.h" | 8 #include "cc/resources/scoped_ui_resource.h" |
| 9 #include "content/public/browser/android/compositor.h" | 9 #include "content/public/browser/android/compositor.h" |
| 10 #include "content/public/browser/android/content_view_core.h" | |
| 11 #include "ui/android/resources/resource_manager.h" | 10 #include "ui/android/resources/resource_manager.h" |
| 12 | 11 |
| 13 namespace chrome { | 12 namespace chrome { |
| 14 namespace android { | 13 namespace android { |
| 15 | 14 |
| 16 // static | 15 // static |
| 17 scoped_refptr<ReaderModeLayer> ReaderModeLayer::Create( | 16 scoped_refptr<ReaderModeLayer> ReaderModeLayer::Create( |
| 18 ui::ResourceManager* resource_manager) { | 17 ui::ResourceManager* resource_manager) { |
| 19 return make_scoped_refptr(new ReaderModeLayer(resource_manager)); | 18 return make_scoped_refptr(new ReaderModeLayer(resource_manager)); |
| 20 } | 19 } |
| 21 | 20 |
| 22 void ReaderModeLayer::SetProperties( | 21 void ReaderModeLayer::SetProperties( |
| 23 float dp_to_px, | 22 float dp_to_px, |
| 24 content::ContentViewCore* content_view_core, | 23 const scoped_refptr<cc::Layer>& content_layer, |
| 25 float panel_x, | 24 float panel_x, |
| 26 float panel_y, | 25 float panel_y, |
| 27 float panel_width, | 26 float panel_width, |
| 28 float panel_height, | 27 float panel_height, |
| 29 float bar_margin_side, | 28 float bar_margin_side, |
| 30 float bar_height, | 29 float bar_height, |
| 31 float text_opacity, | 30 float text_opacity, |
| 32 bool bar_border_visible, | 31 bool bar_border_visible, |
| 33 float bar_border_height, | 32 float bar_border_height, |
| 34 bool bar_shadow_visible, | 33 bool bar_shadow_visible, |
| 35 float bar_shadow_opacity) { | 34 float bar_shadow_opacity) { |
| 36 // Round values to avoid pixel gap between layers. | 35 // Round values to avoid pixel gap between layers. |
| 37 bar_height = floor(bar_height); | 36 bar_height = floor(bar_height); |
| 38 | 37 |
| 39 OverlayPanelLayer::SetProperties( | 38 OverlayPanelLayer::SetProperties( |
| 40 dp_to_px, | 39 dp_to_px, |
| 41 content_view_core, | 40 content_layer, |
| 42 bar_height, | 41 bar_height, |
| 43 panel_x, | 42 panel_x, |
| 44 panel_y, | 43 panel_y, |
| 45 panel_width, | 44 panel_width, |
| 46 panel_height, | 45 panel_height, |
| 47 bar_margin_side, | 46 bar_margin_side, |
| 48 bar_height, | 47 bar_height, |
| 49 0.0f, | 48 0.0f, |
| 50 text_opacity, | 49 text_opacity, |
| 51 bar_border_visible, | 50 bar_border_visible, |
| 52 bar_border_height, | 51 bar_border_height, |
| 53 bar_shadow_visible, | 52 bar_shadow_visible, |
| 54 bar_shadow_opacity, | 53 bar_shadow_opacity, |
| 55 1.0f); | 54 1.0f); |
| 56 } | 55 } |
| 57 | 56 |
| 58 ReaderModeLayer::ReaderModeLayer( | 57 ReaderModeLayer::ReaderModeLayer( |
| 59 ui::ResourceManager* resource_manager) | 58 ui::ResourceManager* resource_manager) |
| 60 : OverlayPanelLayer(resource_manager) { | 59 : OverlayPanelLayer(resource_manager) { |
| 61 } | 60 } |
| 62 | 61 |
| 63 ReaderModeLayer::~ReaderModeLayer() { | 62 ReaderModeLayer::~ReaderModeLayer() { |
| 64 } | 63 } |
| 65 | 64 |
| 66 } // namespace android | 65 } // namespace android |
| 67 } // namespace chrome | 66 } // namespace chrome |
| OLD | NEW |