| OLD | NEW |
| 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, | 33 jint panel_icon_resource_id, |
| 32 jint arrow_up_resource_id, | 34 jint arrow_up_resource_id, |
| 33 jint close_icon_resource_id, | 35 jint close_icon_resource_id, |
| 34 jint progress_bar_background_resource_id, | 36 jint progress_bar_background_resource_id, |
| 35 jint progress_bar_resource_id, | 37 jint progress_bar_resource_id, |
| 36 jint search_promo_resource_id, | 38 jint search_promo_resource_id, |
| 37 jint peek_promo_ripple_resource_id, | 39 jint peek_promo_ripple_resource_id, |
| 38 jint peek_promo_text_resource_id, | 40 jint peek_promo_text_resource_id, |
| 41 jint search_provider_icon_sprite_bitmap_resource_id, |
| 42 jint search_provider_icon_sprite_metadata_resource_id, |
| 39 jobject jcontent_view_core, | 43 jobject jcontent_view_core, |
| 40 jboolean search_promo_visible, | 44 jboolean search_promo_visible, |
| 41 jfloat search_promo_height, | 45 jfloat search_promo_height, |
| 42 jfloat search_promo_opacity, | 46 jfloat search_promo_opacity, |
| 43 jboolean search_peek_promo_visible, | 47 jboolean search_peek_promo_visible, |
| 44 jfloat search_peek_promo_height, | 48 jfloat search_peek_promo_height, |
| 45 jfloat search_peek_promo_padding, | 49 jfloat search_peek_promo_padding, |
| 46 jfloat search_peek_promo_ripple_width, | 50 jfloat search_peek_promo_ripple_width, |
| 47 jfloat search_peek_promo_ripple_opacity, | 51 jfloat search_peek_promo_ripple_opacity, |
| 48 jfloat search_peek_promo_text_opacity, | 52 jfloat search_peek_promo_text_opacity, |
| 49 jfloat search_panel_X, | 53 jfloat search_panel_X, |
| 50 jfloat search_panel_y, | 54 jfloat search_panel_y, |
| 51 jfloat search_panel_width, | 55 jfloat search_panel_width, |
| 52 jfloat search_panel_height, | 56 jfloat search_panel_height, |
| 53 jfloat search_bar_margin_side, | 57 jfloat search_bar_margin_side, |
| 54 jfloat search_bar_height, | 58 jfloat search_bar_height, |
| 55 jfloat search_context_opacity, | 59 jfloat search_context_opacity, |
| 56 jfloat search_term_opacity, | 60 jfloat search_term_opacity, |
| 57 jboolean search_bar_border_visible, | 61 jboolean search_bar_border_visible, |
| 58 jfloat search_bar_border_height, | 62 jfloat search_bar_border_height, |
| 59 jboolean search_bar_shadow_visible, | 63 jboolean search_bar_shadow_visible, |
| 60 jfloat search_bar_shadow_opacity, | 64 jfloat search_bar_shadow_opacity, |
| 65 jboolean search_provider_icon_sprite_visible, |
| 66 jfloat search_provider_icon_sprite_completion_percentage, |
| 67 jfloat search_provider_icon_sprite_size, |
| 61 jfloat arrow_icon_opacity, | 68 jfloat arrow_icon_opacity, |
| 62 jfloat arrow_icon_rotation, | 69 jfloat arrow_icon_rotation, |
| 63 jfloat close_icon_opacity, | 70 jfloat close_icon_opacity, |
| 64 jboolean progress_bar_visible, | 71 jboolean progress_bar_visible, |
| 65 jfloat progress_bar_height, | 72 jfloat progress_bar_height, |
| 66 jfloat progress_bar_opacity, | 73 jfloat progress_bar_opacity, |
| 67 jint progress_bar_completion, | 74 jint progress_bar_completion, |
| 68 jobject jresource_manager) { | 75 jobject jresource_manager) { |
| 69 ui::ResourceManager* resource_manager = | 76 ui::ResourceManager* resource_manager = |
| 70 ui::ResourceManagerImpl::FromJavaObject(jresource_manager); | 77 ui::ResourceManagerImpl::FromJavaObject(jresource_manager); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 83 content::ContentViewCore* content_view_core = | 90 content::ContentViewCore* content_view_core = |
| 84 !jcontent_view_core ? NULL | 91 !jcontent_view_core ? NULL |
| 85 : content::ContentViewCore::GetNativeContentViewCore( | 92 : content::ContentViewCore::GetNativeContentViewCore( |
| 86 env, jcontent_view_core); | 93 env, jcontent_view_core); |
| 87 | 94 |
| 88 contextual_search_layer_->SetProperties( | 95 contextual_search_layer_->SetProperties( |
| 89 search_bar_background_resource_id, | 96 search_bar_background_resource_id, |
| 90 search_context_resource_id, | 97 search_context_resource_id, |
| 91 search_term_resource_id, | 98 search_term_resource_id, |
| 92 search_bar_shadow_resource_id, | 99 search_bar_shadow_resource_id, |
| 93 search_provider_icon_resource_id, | 100 panel_icon_resource_id, |
| 94 arrow_up_resource_id, | 101 arrow_up_resource_id, |
| 95 close_icon_resource_id, | 102 close_icon_resource_id, |
| 96 progress_bar_background_resource_id, | 103 progress_bar_background_resource_id, |
| 97 progress_bar_resource_id, | 104 progress_bar_resource_id, |
| 98 search_promo_resource_id, | 105 search_promo_resource_id, |
| 99 peek_promo_ripple_resource_id, | 106 peek_promo_ripple_resource_id, |
| 100 peek_promo_text_resource_id, | 107 peek_promo_text_resource_id, |
| 108 search_provider_icon_sprite_bitmap_resource_id, |
| 109 search_provider_icon_sprite_metadata_resource_id, |
| 101 content_view_core, | 110 content_view_core, |
| 102 search_promo_visible, | 111 search_promo_visible, |
| 103 search_promo_height, | 112 search_promo_height, |
| 104 search_promo_opacity, | 113 search_promo_opacity, |
| 105 search_peek_promo_visible, | 114 search_peek_promo_visible, |
| 106 search_peek_promo_height, | 115 search_peek_promo_height, |
| 107 search_peek_promo_padding, | 116 search_peek_promo_padding, |
| 108 search_peek_promo_ripple_width, | 117 search_peek_promo_ripple_width, |
| 109 search_peek_promo_ripple_opacity, | 118 search_peek_promo_ripple_opacity, |
| 110 search_peek_promo_text_opacity, | 119 search_peek_promo_text_opacity, |
| 111 search_panel_X, | 120 search_panel_X, |
| 112 search_panel_y, | 121 search_panel_y, |
| 113 search_panel_width, | 122 search_panel_width, |
| 114 search_panel_height, | 123 search_panel_height, |
| 115 search_bar_margin_side, | 124 search_bar_margin_side, |
| 116 search_bar_height, | 125 search_bar_height, |
| 117 search_context_opacity, | 126 search_context_opacity, |
| 118 search_term_opacity, | 127 search_term_opacity, |
| 119 search_bar_border_visible, | 128 search_bar_border_visible, |
| 120 search_bar_border_height, | 129 search_bar_border_height, |
| 121 search_bar_shadow_visible, | 130 search_bar_shadow_visible, |
| 122 search_bar_shadow_opacity, | 131 search_bar_shadow_opacity, |
| 132 search_provider_icon_sprite_visible, |
| 133 search_provider_icon_sprite_completion_percentage, |
| 134 search_provider_icon_sprite_size, |
| 123 arrow_icon_opacity, | 135 arrow_icon_opacity, |
| 124 arrow_icon_rotation, | 136 arrow_icon_rotation, |
| 125 close_icon_opacity, | 137 close_icon_opacity, |
| 126 progress_bar_visible, | 138 progress_bar_visible, |
| 127 progress_bar_height, | 139 progress_bar_height, |
| 128 progress_bar_opacity, | 140 progress_bar_opacity, |
| 129 progress_bar_completion); | 141 progress_bar_completion); |
| 130 } | 142 } |
| 131 | 143 |
| 132 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) { | 144 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) { |
| 133 // This will automatically bind to the Java object and pass ownership there. | 145 // This will automatically bind to the Java object and pass ownership there. |
| 134 ContextualSearchSceneLayer* tree_provider = | 146 ContextualSearchSceneLayer* tree_provider = |
| 135 new ContextualSearchSceneLayer(env, jobj); | 147 new ContextualSearchSceneLayer(env, jobj); |
| 136 return reinterpret_cast<intptr_t>(tree_provider); | 148 return reinterpret_cast<intptr_t>(tree_provider); |
| 137 } | 149 } |
| 138 | 150 |
| 139 bool RegisterContextualSearchSceneLayer(JNIEnv* env) { | 151 bool RegisterContextualSearchSceneLayer(JNIEnv* env) { |
| 140 return RegisterNativesImpl(env); | 152 return RegisterNativesImpl(env); |
| 141 } | 153 } |
| 142 | 154 |
| 143 } // namespace android | 155 } // namespace android |
| 144 } // namespace chrome | 156 } // namespace chrome |
| OLD | NEW |