Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: chrome/browser/android/compositor/scene_layer/contextual_search_scene_layer.cc

Issue 1337703002: [Contextual Search] Add support for crushed sprites and animate the search provider icon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes from last dtrainor@ review Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/scene_layer/contextual_search_scene_ layer.h" 5 #include "chrome/browser/android/compositor/scene_layer/contextual_search_scene_ layer.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h"
8 #include "chrome/browser/android/compositor/layer/contextual_search_layer.h" 9 #include "chrome/browser/android/compositor/layer/contextual_search_layer.h"
9 #include "content/public/browser/android/content_view_core.h" 10 #include "content/public/browser/android/content_view_core.h"
10 #include "jni/ContextualSearchSceneLayer_jni.h" 11 #include "jni/ContextualSearchSceneLayer_jni.h"
11 #include "ui/android/resources/resource_manager_impl.h" 12 #include "ui/android/resources/resource_manager_impl.h"
13 #include "ui/gfx/android/java_bitmap.h"
12 14
13 namespace chrome { 15 namespace chrome {
14 namespace android { 16 namespace android {
15 17
16 ContextualSearchSceneLayer::ContextualSearchSceneLayer(JNIEnv* env, 18 ContextualSearchSceneLayer::ContextualSearchSceneLayer(JNIEnv* env,
17 jobject jobj) 19 jobject jobj)
18 : SceneLayer(env, jobj) { 20 : SceneLayer(env, jobj) {
19 } 21 }
20 22
21 ContextualSearchSceneLayer::~ContextualSearchSceneLayer() { 23 ContextualSearchSceneLayer::~ContextualSearchSceneLayer() {
22 } 24 }
23 25
24 void ContextualSearchSceneLayer::UpdateContextualSearchLayer( 26 void ContextualSearchSceneLayer::UpdateContextualSearchLayer(
25 JNIEnv* env, 27 JNIEnv* env,
26 jobject object, 28 jobject object,
27 jint search_bar_background_resource_id, 29 jint search_bar_background_resource_id,
28 jint search_context_resource_id, 30 jint search_context_resource_id,
29 jint search_term_resource_id, 31 jint search_term_resource_id,
30 jint search_bar_shadow_resource_id, 32 jint search_bar_shadow_resource_id,
31 jint search_provider_icon_resource_id,
32 jint arrow_up_resource_id, 33 jint arrow_up_resource_id,
33 jint close_icon_resource_id, 34 jint close_icon_resource_id,
34 jint progress_bar_background_resource_id, 35 jint progress_bar_background_resource_id,
35 jint progress_bar_resource_id, 36 jint progress_bar_resource_id,
36 jint search_promo_resource_id, 37 jint search_promo_resource_id,
37 jint peek_promo_ripple_resource_id, 38 jint peek_promo_ripple_resource_id,
38 jint peek_promo_text_resource_id, 39 jint peek_promo_text_resource_id,
40 jint search_provider_icon_sprite_bitmap_resource_id,
41 jint search_provider_icon_sprite_metadata_resource_id,
39 jobject jcontent_view_core, 42 jobject jcontent_view_core,
40 jboolean search_promo_visible, 43 jboolean search_promo_visible,
41 jfloat search_promo_height, 44 jfloat search_promo_height,
42 jfloat search_promo_opacity, 45 jfloat search_promo_opacity,
43 jboolean search_peek_promo_visible, 46 jboolean search_peek_promo_visible,
44 jfloat search_peek_promo_height, 47 jfloat search_peek_promo_height,
45 jfloat search_peek_promo_padding, 48 jfloat search_peek_promo_padding,
46 jfloat search_peek_promo_ripple_width, 49 jfloat search_peek_promo_ripple_width,
47 jfloat search_peek_promo_ripple_opacity, 50 jfloat search_peek_promo_ripple_opacity,
48 jfloat search_peek_promo_text_opacity, 51 jfloat search_peek_promo_text_opacity,
49 jfloat search_panel_X, 52 jfloat search_panel_X,
50 jfloat search_panel_y, 53 jfloat search_panel_y,
51 jfloat search_panel_width, 54 jfloat search_panel_width,
52 jfloat search_panel_height, 55 jfloat search_panel_height,
53 jfloat search_bar_margin_side, 56 jfloat search_bar_margin_side,
54 jfloat search_bar_height, 57 jfloat search_bar_height,
55 jfloat search_context_opacity, 58 jfloat search_context_opacity,
56 jfloat search_term_opacity, 59 jfloat search_term_opacity,
57 jboolean search_bar_border_visible, 60 jboolean search_bar_border_visible,
58 jfloat search_bar_border_height, 61 jfloat search_bar_border_height,
59 jboolean search_bar_shadow_visible, 62 jboolean search_bar_shadow_visible,
60 jfloat search_bar_shadow_opacity, 63 jfloat search_bar_shadow_opacity,
64 jboolean search_provider_icon_sprite_visible,
65 jint search_provider_icon_sprite_frame,
66 jfloat search_provider_icon_sprite_size,
61 jfloat arrow_icon_opacity, 67 jfloat arrow_icon_opacity,
62 jfloat arrow_icon_rotation, 68 jfloat arrow_icon_rotation,
63 jfloat close_icon_opacity, 69 jfloat close_icon_opacity,
64 jboolean progress_bar_visible, 70 jboolean progress_bar_visible,
65 jfloat progress_bar_height, 71 jfloat progress_bar_height,
66 jfloat progress_bar_opacity, 72 jfloat progress_bar_opacity,
67 jint progress_bar_completion, 73 jint progress_bar_completion,
68 jobject jresource_manager) { 74 jobject jresource_manager) {
69 ui::ResourceManager* resource_manager = 75 ui::ResourceManager* resource_manager =
70 ui::ResourceManagerImpl::FromJavaObject(jresource_manager); 76 ui::ResourceManagerImpl::FromJavaObject(jresource_manager);
(...skipping 12 matching lines...) Expand all
83 content::ContentViewCore* content_view_core = 89 content::ContentViewCore* content_view_core =
84 !jcontent_view_core ? NULL 90 !jcontent_view_core ? NULL
85 : content::ContentViewCore::GetNativeContentViewCore( 91 : content::ContentViewCore::GetNativeContentViewCore(
86 env, jcontent_view_core); 92 env, jcontent_view_core);
87 93
88 contextual_search_layer_->SetProperties( 94 contextual_search_layer_->SetProperties(
89 search_bar_background_resource_id, 95 search_bar_background_resource_id,
90 search_context_resource_id, 96 search_context_resource_id,
91 search_term_resource_id, 97 search_term_resource_id,
92 search_bar_shadow_resource_id, 98 search_bar_shadow_resource_id,
93 search_provider_icon_resource_id,
94 arrow_up_resource_id, 99 arrow_up_resource_id,
95 close_icon_resource_id, 100 close_icon_resource_id,
96 progress_bar_background_resource_id, 101 progress_bar_background_resource_id,
97 progress_bar_resource_id, 102 progress_bar_resource_id,
98 search_promo_resource_id, 103 search_promo_resource_id,
99 peek_promo_ripple_resource_id, 104 peek_promo_ripple_resource_id,
100 peek_promo_text_resource_id, 105 peek_promo_text_resource_id,
106 search_provider_icon_sprite_bitmap_resource_id,
107 search_provider_icon_sprite_metadata_resource_id,
101 content_view_core, 108 content_view_core,
102 search_promo_visible, 109 search_promo_visible,
103 search_promo_height, 110 search_promo_height,
104 search_promo_opacity, 111 search_promo_opacity,
105 search_peek_promo_visible, 112 search_peek_promo_visible,
106 search_peek_promo_height, 113 search_peek_promo_height,
107 search_peek_promo_padding, 114 search_peek_promo_padding,
108 search_peek_promo_ripple_width, 115 search_peek_promo_ripple_width,
109 search_peek_promo_ripple_opacity, 116 search_peek_promo_ripple_opacity,
110 search_peek_promo_text_opacity, 117 search_peek_promo_text_opacity,
111 search_panel_X, 118 search_panel_X,
112 search_panel_y, 119 search_panel_y,
113 search_panel_width, 120 search_panel_width,
114 search_panel_height, 121 search_panel_height,
115 search_bar_margin_side, 122 search_bar_margin_side,
116 search_bar_height, 123 search_bar_height,
117 search_context_opacity, 124 search_context_opacity,
118 search_term_opacity, 125 search_term_opacity,
119 search_bar_border_visible, 126 search_bar_border_visible,
120 search_bar_border_height, 127 search_bar_border_height,
121 search_bar_shadow_visible, 128 search_bar_shadow_visible,
122 search_bar_shadow_opacity, 129 search_bar_shadow_opacity,
130 search_provider_icon_sprite_visible,
131 search_provider_icon_sprite_frame,
132 search_provider_icon_sprite_size,
123 arrow_icon_opacity, 133 arrow_icon_opacity,
124 arrow_icon_rotation, 134 arrow_icon_rotation,
125 close_icon_opacity, 135 close_icon_opacity,
126 progress_bar_visible, 136 progress_bar_visible,
127 progress_bar_height, 137 progress_bar_height,
128 progress_bar_opacity, 138 progress_bar_opacity,
129 progress_bar_completion); 139 progress_bar_completion);
130 } 140 }
131 141
132 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) { 142 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
133 // This will automatically bind to the Java object and pass ownership there. 143 // This will automatically bind to the Java object and pass ownership there.
134 ContextualSearchSceneLayer* tree_provider = 144 ContextualSearchSceneLayer* tree_provider =
135 new ContextualSearchSceneLayer(env, jobj); 145 new ContextualSearchSceneLayer(env, jobj);
136 return reinterpret_cast<intptr_t>(tree_provider); 146 return reinterpret_cast<intptr_t>(tree_provider);
137 } 147 }
138 148
139 bool RegisterContextualSearchSceneLayer(JNIEnv* env) { 149 bool RegisterContextualSearchSceneLayer(JNIEnv* env) {
140 return RegisterNativesImpl(env); 150 return RegisterNativesImpl(env);
141 } 151 }
142 152
143 } // namespace android 153 } // namespace android
144 } // namespace chrome 154 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698