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 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTEXTUAL_SEARCH_LAYER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTEXTUAL_SEARCH_LAYER_H_ |
6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTEXTUAL_SEARCH_LAYER_H_ | 6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTEXTUAL_SEARCH_LAYER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "chrome/browser/android/compositor/layer/overlay_panel_layer.h" | 10 #include "chrome/browser/android/compositor/layer/overlay_panel_layer.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 class Layer; | 13 class Layer; |
14 class NinePatchLayer; | 14 class NinePatchLayer; |
15 class SolidColorLayer; | 15 class SolidColorLayer; |
16 class UIResourceLayer; | 16 class UIResourceLayer; |
17 } | 17 } |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 class Layer; | 20 class Layer; |
21 } | 21 } |
22 | 22 |
23 namespace ui { | 23 namespace ui { |
24 class ResourceManager; | 24 class ResourceManager; |
25 } | 25 } |
26 | 26 |
27 namespace android { | 27 namespace android { |
28 | 28 |
29 class CrushedSpriteLayer; | |
30 | |
31 class ContextualSearchLayer : public OverlayPanelLayer { | 29 class ContextualSearchLayer : public OverlayPanelLayer { |
32 public: | 30 public: |
33 static scoped_refptr<ContextualSearchLayer> Create( | 31 static scoped_refptr<ContextualSearchLayer> Create( |
34 ui::ResourceManager* resource_manager); | 32 ui::ResourceManager* resource_manager); |
35 | 33 |
36 void SetProperties(int panel_shadow_resource_id, | 34 void SetProperties(int panel_shadow_resource_id, |
37 int search_context_resource_id, | 35 int search_context_resource_id, |
38 int search_term_resource_id, | 36 int search_term_resource_id, |
39 int search_caption_resource_id, | 37 int search_caption_resource_id, |
40 int search_bar_shadow_resource_id, | 38 int search_bar_shadow_resource_id, |
41 int sprite_resource_id, | 39 int search_provider_icon_resource_id, |
42 int search_provider_icon_sprite_metadata_resource_id, | 40 int quick_action_icon_resource_id, |
43 int quick_action_icon_resource_id, | |
44 int arrow_up_resource_id, | 41 int arrow_up_resource_id, |
45 int close_icon_resource_id, | 42 int close_icon_resource_id, |
46 int progress_bar_background_resource_id, | 43 int progress_bar_background_resource_id, |
47 int progress_bar_resource_id, | 44 int progress_bar_resource_id, |
48 int search_promo_resource_id, | 45 int search_promo_resource_id, |
49 int peek_promo_ripple_resource_id, | 46 int peek_promo_ripple_resource_id, |
50 int peek_promo_text_resource_id, | 47 int peek_promo_text_resource_id, |
51 float dp_to_px, | 48 float dp_to_px, |
52 const scoped_refptr<cc::Layer>& content_layer, | 49 const scoped_refptr<cc::Layer>& content_layer, |
53 bool search_promo_visible, | 50 bool search_promo_visible, |
(...skipping 14 matching lines...) Expand all Loading... |
68 float search_context_opacity, | 65 float search_context_opacity, |
69 float search_text_layer_min_height, | 66 float search_text_layer_min_height, |
70 float search_term_opacity, | 67 float search_term_opacity, |
71 float search_term_caption_spacing, | 68 float search_term_caption_spacing, |
72 float search_caption_animation_percentage, | 69 float search_caption_animation_percentage, |
73 bool search_caption_visible, | 70 bool search_caption_visible, |
74 bool search_bar_border_visible, | 71 bool search_bar_border_visible, |
75 float search_bar_border_height, | 72 float search_bar_border_height, |
76 bool search_bar_shadow_visible, | 73 bool search_bar_shadow_visible, |
77 float search_bar_shadow_opacity, | 74 float search_bar_shadow_opacity, |
78 bool search_provider_icon_sprite_visible, | |
79 float search_provider_icon_sprite_completion_percentage, | |
80 bool quick_action_icon_visible, | 75 bool quick_action_icon_visible, |
81 bool thumbnail_visible, | 76 bool thumbnail_visible, |
82 float static_image_visibility_percentage, | 77 float custom_image_visibility_percentage, |
83 int static_image_size, | 78 int bar_image_size, |
84 float arrow_icon_opacity, | 79 float arrow_icon_opacity, |
85 float arrow_icon_rotation, | 80 float arrow_icon_rotation, |
86 float close_icon_opacity, | 81 float close_icon_opacity, |
87 bool progress_bar_visible, | 82 bool progress_bar_visible, |
88 float progress_bar_height, | 83 float progress_bar_height, |
89 float progress_bar_opacity, | 84 float progress_bar_opacity, |
90 int progress_bar_completion, | 85 int progress_bar_completion, |
91 float divider_line_visibility_percentage, | 86 float divider_line_visibility_percentage, |
92 float divider_line_width, | 87 float divider_line_width, |
93 float divider_line_height, | 88 float divider_line_height, |
94 int divider_line_color, | 89 int divider_line_color, |
95 float divider_line_x_offset, | 90 float divider_line_x_offset, |
96 bool touch_highlight_visible, | 91 bool touch_highlight_visible, |
97 float touch_highlight_x_offset, | 92 float touch_highlight_x_offset, |
98 float touch_highlight_width); | 93 float touch_highlight_width); |
99 | 94 |
100 void SetThumbnail(const SkBitmap* thumbnail); | 95 void SetThumbnail(const SkBitmap* thumbnail); |
101 | 96 |
102 protected: | 97 protected: |
103 explicit ContextualSearchLayer(ui::ResourceManager* resource_manager); | 98 explicit ContextualSearchLayer(ui::ResourceManager* resource_manager); |
104 ~ContextualSearchLayer() override; | 99 ~ContextualSearchLayer() override; |
105 scoped_refptr<cc::Layer> GetIconLayer() override; | 100 scoped_refptr<cc::Layer> GetIconLayer() override; |
106 | 101 |
107 private: | 102 private: |
108 // Sets up |icon_layer_|, which displays an icon or thumbnail at the start | 103 // Sets up |icon_layer_|, which displays an icon or thumbnail at the start |
109 // of the Bar. | 104 // of the Bar. |
110 void SetupIconLayer(bool search_provider_icon_sprite_visible, | 105 void SetupIconLayer(int search_provider_icon_resource_id, |
111 int search_provider_icon_sprite_metadata_resource_id, | |
112 float search_provider_icon_sprite_completion_percentage, | |
113 bool quick_action_icon_visible, | 106 bool quick_action_icon_visible, |
114 int quick_action_icon_resource_id, | 107 int quick_action_icon_resource_id, |
115 bool thumbnail_visible, | 108 bool thumbnail_visible, |
116 float static_image_visibility_percentage); | 109 float custom_image_visibility_percentage); |
117 | 110 |
118 void SetStaticImageProperties( | 111 void SetCustomImageProperties( |
119 scoped_refptr<cc::UIResourceLayer> static_image_layer, | 112 scoped_refptr<cc::UIResourceLayer> custom_image_layer, |
120 float top_margin, | 113 float top_margin, |
121 float side_margin, | 114 float side_margin, |
122 float visibility_percentage); | 115 float visibility_percentage); |
123 | 116 |
124 // Sets up |text_layer_|, which contains |bar_text_|, |search_context_| and | 117 // Sets up |text_layer_|, which contains |bar_text_|, |search_context_| and |
125 // |search_caption_|. | 118 // |search_caption_|. |
126 void SetupTextLayer(float search_bar_top, | 119 void SetupTextLayer(float search_bar_top, |
127 float search_bar_height, | 120 float search_bar_height, |
128 float search_text_layer_min_height, | 121 float search_text_layer_min_height, |
129 int search_caption_resource_id, | 122 int search_caption_resource_id, |
130 bool search_caption_visible, | 123 bool search_caption_visible, |
131 float search_caption_animation_percentage, | 124 float search_caption_animation_percentage, |
132 float search_term_opacity, | 125 float search_term_opacity, |
133 int search_context_resource_id, | 126 int search_context_resource_id, |
134 float search_context_opacity, | 127 float search_context_opacity, |
135 float search_term_caption_spacing); | 128 float search_term_caption_spacing); |
136 | 129 |
137 int static_image_size_; | 130 int bar_image_size_; |
138 float thumbnail_side_margin_; | 131 float thumbnail_side_margin_; |
139 float thumbnail_top_margin_; | 132 float thumbnail_top_margin_; |
140 | 133 |
141 scoped_refptr<cc::UIResourceLayer> search_context_; | 134 scoped_refptr<cc::UIResourceLayer> search_context_; |
142 scoped_refptr<cc::Layer> icon_layer_; | 135 scoped_refptr<cc::Layer> icon_layer_; |
143 scoped_refptr<CrushedSpriteLayer> search_provider_icon_sprite_; | 136 scoped_refptr<cc::UIResourceLayer> search_provider_icon_layer_; |
144 scoped_refptr<cc::UIResourceLayer> thumbnail_layer_; | 137 scoped_refptr<cc::UIResourceLayer> thumbnail_layer_; |
145 scoped_refptr<cc::UIResourceLayer> quick_action_icon_layer_; | 138 scoped_refptr<cc::UIResourceLayer> quick_action_icon_layer_; |
146 scoped_refptr<cc::UIResourceLayer> arrow_icon_; | 139 scoped_refptr<cc::UIResourceLayer> arrow_icon_; |
147 scoped_refptr<cc::UIResourceLayer> search_promo_; | 140 scoped_refptr<cc::UIResourceLayer> search_promo_; |
148 scoped_refptr<cc::SolidColorLayer> search_promo_container_; | 141 scoped_refptr<cc::SolidColorLayer> search_promo_container_; |
149 scoped_refptr<cc::SolidColorLayer> peek_promo_container_; | 142 scoped_refptr<cc::SolidColorLayer> peek_promo_container_; |
150 scoped_refptr<cc::NinePatchLayer> peek_promo_ripple_; | 143 scoped_refptr<cc::NinePatchLayer> peek_promo_ripple_; |
151 scoped_refptr<cc::UIResourceLayer> peek_promo_text_; | 144 scoped_refptr<cc::UIResourceLayer> peek_promo_text_; |
152 scoped_refptr<cc::NinePatchLayer> progress_bar_; | 145 scoped_refptr<cc::NinePatchLayer> progress_bar_; |
153 scoped_refptr<cc::NinePatchLayer> progress_bar_background_; | 146 scoped_refptr<cc::NinePatchLayer> progress_bar_background_; |
154 scoped_refptr<cc::UIResourceLayer> search_caption_; | 147 scoped_refptr<cc::UIResourceLayer> search_caption_; |
155 scoped_refptr<cc::UIResourceLayer> text_layer_; | 148 scoped_refptr<cc::UIResourceLayer> text_layer_; |
156 scoped_refptr<cc::SolidColorLayer> divider_line_; | 149 scoped_refptr<cc::SolidColorLayer> divider_line_; |
157 scoped_refptr<cc::SolidColorLayer> touch_highlight_layer_; | 150 scoped_refptr<cc::SolidColorLayer> touch_highlight_layer_; |
158 }; | 151 }; |
159 | 152 |
160 } // namespace android | 153 } // namespace android |
161 | 154 |
162 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTEXTUAL_SEARCH_LAYER_H_ | 155 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTEXTUAL_SEARCH_LAYER_H_ |
OLD | NEW |