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

Side by Side Diff: ui/android/view_android.cc

Issue 2282983004: Android: Fix benchmark regression (Closed)
Patch Set: Android: Fix benchmark regression Created 4 years, 3 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
« no previous file with comments | « device/power_save_blocker/power_save_blocker_android.cc ('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 "ui/android/view_android.h" 5 #include "ui/android/view_android.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 if (delegate.is_null()) 106 if (delegate.is_null())
107 return ViewAndroid::ScopedAnchorView(); 107 return ViewAndroid::ScopedAnchorView();
108 108
109 JNIEnv* env = base::android::AttachCurrentThread(); 109 JNIEnv* env = base::android::AttachCurrentThread();
110 return ViewAndroid::ScopedAnchorView( 110 return ViewAndroid::ScopedAnchorView(
111 env, Java_ViewAndroidDelegate_acquireView(env, delegate), delegate); 111 env, Java_ViewAndroidDelegate_acquireView(env, delegate), delegate);
112 } 112 }
113 113
114 void ViewAndroid::SetAnchorRect(const JavaRef<jobject>& anchor, 114 void ViewAndroid::SetAnchorRect(const JavaRef<jobject>& anchor,
115 const gfx::RectF& bounds) { 115 const gfx::RectF& bounds) {
116 if (bounds.IsEmpty())
117 return;
118
119 ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); 116 ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate());
120 if (delegate.is_null()) 117 if (delegate.is_null())
121 return; 118 return;
122 119
123 float scale = display::Screen::GetScreen() 120 float scale = display::Screen::GetScreen()
124 ->GetDisplayNearestWindow(this) 121 ->GetDisplayNearestWindow(this)
125 .device_scale_factor(); 122 .device_scale_factor();
126 int left_margin = std::round(bounds.x() * scale); 123 int left_margin = std::round(bounds.x() * scale);
127 // TODO(jinsukkim): Move content_offset() to ViewAndroid, since it's 124 // TODO(jinsukkim): Move content_offset() to ViewAndroid, since it's
128 // specific to a given web contents/render widget. 125 // specific to a given web contents/render widget.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 void ViewAndroid::StartDragAndDrop(const JavaRef<jstring>& jtext, 167 void ViewAndroid::StartDragAndDrop(const JavaRef<jstring>& jtext,
171 const JavaRef<jobject>& jimage) { 168 const JavaRef<jobject>& jimage) {
172 ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); 169 ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate());
173 if (delegate.is_null()) 170 if (delegate.is_null())
174 return; 171 return;
175 JNIEnv* env = base::android::AttachCurrentThread(); 172 JNIEnv* env = base::android::AttachCurrentThread();
176 Java_ViewAndroidDelegate_startDragAndDrop(env, delegate, jtext, jimage); 173 Java_ViewAndroidDelegate_startDragAndDrop(env, delegate, jtext, jimage);
177 } 174 }
178 175
179 } // namespace ui 176 } // namespace ui
OLDNEW
« no previous file with comments | « device/power_save_blocker/power_save_blocker_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698