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

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

Issue 2542883004: Bottom browser controls position based on window height (Closed)
Patch Set: rebase Created 4 years 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
« no previous file with comments | « chrome/browser/android/compositor/scene_layer/toolbar_scene_layer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/scene_layer/toolbar_scene_layer.h" 5 #include "chrome/browser/android/compositor/scene_layer/toolbar_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 "base/android/jni_array.h"
9 #include "cc/layers/solid_color_layer.h" 9 #include "cc/layers/solid_color_layer.h"
10 #include "chrome/browser/android/compositor/layer/toolbar_layer.h" 10 #include "chrome/browser/android/compositor/layer/toolbar_layer.h"
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 void ToolbarSceneLayer::UpdateToolbarLayer( 33 void ToolbarSceneLayer::UpdateToolbarLayer(
34 JNIEnv* env, 34 JNIEnv* env,
35 const JavaParamRef<jobject>& object, 35 const JavaParamRef<jobject>& object,
36 const JavaParamRef<jobject>& jresource_manager, 36 const JavaParamRef<jobject>& jresource_manager,
37 jint toolbar_resource_id, 37 jint toolbar_resource_id,
38 jint toolbar_background_color, 38 jint toolbar_background_color,
39 jint url_bar_resource_id, 39 jint url_bar_resource_id,
40 jfloat url_bar_alpha, 40 jfloat url_bar_alpha,
41 jfloat top_offset, 41 jfloat y_offset,
42 jfloat view_height, 42 jfloat view_height,
43 bool visible, 43 bool visible,
44 bool show_shadow, 44 bool show_shadow,
45 bool browser_controls_at_bottom) { 45 bool browser_controls_at_bottom) {
46 // If the toolbar layer has not been created yet, create it. 46 // If the toolbar layer has not been created yet, create it.
47 if (!toolbar_layer_) { 47 if (!toolbar_layer_) {
48 ui::ResourceManager* resource_manager = 48 ui::ResourceManager* resource_manager =
49 ui::ResourceManagerImpl::FromJavaObject(jresource_manager); 49 ui::ResourceManagerImpl::FromJavaObject(jresource_manager);
50 toolbar_layer_ = ToolbarLayer::Create(resource_manager); 50 toolbar_layer_ = ToolbarLayer::Create(resource_manager);
51 toolbar_layer_->layer()->SetHideLayerAndSubtree(true); 51 toolbar_layer_->layer()->SetHideLayerAndSubtree(true);
52 layer_->AddChild(toolbar_layer_->layer()); 52 layer_->AddChild(toolbar_layer_->layer());
53 } 53 }
54 54
55 toolbar_layer_->layer()->SetHideLayerAndSubtree(!visible); 55 toolbar_layer_->layer()->SetHideLayerAndSubtree(!visible);
56 if (visible) { 56 if (visible) {
57 toolbar_layer_->layer()->SetPosition(gfx::PointF(0, top_offset));
58 toolbar_layer_->PushResource(toolbar_resource_id, toolbar_background_color, 57 toolbar_layer_->PushResource(toolbar_resource_id, toolbar_background_color,
59 false, SK_ColorWHITE, url_bar_resource_id, 58 false, SK_ColorWHITE, url_bar_resource_id,
60 url_bar_alpha, view_height, false, 59 url_bar_alpha, view_height, y_offset, false,
61 !show_shadow, browser_controls_at_bottom); 60 !show_shadow, browser_controls_at_bottom);
62 } 61 }
63 } 62 }
64 63
65 void ToolbarSceneLayer::UpdateProgressBar(JNIEnv* env, 64 void ToolbarSceneLayer::UpdateProgressBar(JNIEnv* env,
66 const JavaParamRef<jobject>& object, 65 const JavaParamRef<jobject>& object,
67 jint progress_bar_x, 66 jint progress_bar_x,
68 jint progress_bar_y, 67 jint progress_bar_y,
69 jint progress_bar_width, 68 jint progress_bar_width,
70 jint progress_bar_height, 69 jint progress_bar_height,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 ToolbarSceneLayer* toolbar_scene_layer = 119 ToolbarSceneLayer* toolbar_scene_layer =
121 new ToolbarSceneLayer(env, jobj); 120 new ToolbarSceneLayer(env, jobj);
122 return reinterpret_cast<intptr_t>(toolbar_scene_layer); 121 return reinterpret_cast<intptr_t>(toolbar_scene_layer);
123 } 122 }
124 123
125 bool RegisterToolbarSceneLayer(JNIEnv* env) { 124 bool RegisterToolbarSceneLayer(JNIEnv* env) {
126 return RegisterNativesImpl(env); 125 return RegisterNativesImpl(env);
127 } 126 }
128 127
129 } // namespace android 128 } // namespace android
OLDNEW
« no previous file with comments | « chrome/browser/android/compositor/scene_layer/toolbar_scene_layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698