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

Side by Side Diff: content/browser/android/composited_touch_handle_drawable.cc

Issue 2417263002: Pass JavaRef to Java methods in ui. (Closed)
Patch Set: Created 4 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 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 #include "content/browser/android/composited_touch_handle_drawable.h" 5 #include "content/browser/android/composited_touch_handle_drawable.h"
6 6
7 #include "base/android/context_utils.h" 7 #include "base/android/context_utils.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/trace_event/trace_event.h" 11 #include "base/trace_event/trace_event.h"
12 #include "cc/layers/ui_resource_layer.h" 12 #include "cc/layers/ui_resource_layer.h"
13 #include "content/public/browser/android/compositor.h" 13 #include "content/public/browser/android/compositor.h"
14 #include "jni/HandleViewResources_jni.h" 14 #include "jni/HandleViewResources_jni.h"
15 #include "ui/gfx/android/java_bitmap.h" 15 #include "ui/gfx/android/java_bitmap.h"
16 16
17 using base::android::JavaRef; 17 using base::android::JavaRef;
18 18
19 namespace content { 19 namespace content {
20 20
21 namespace { 21 namespace {
22 22
23 static SkBitmap CreateSkBitmapFromJavaBitmap( 23 static SkBitmap CreateSkBitmapFromJavaBitmap(
24 base::android::ScopedJavaLocalRef<jobject> jbitmap) { 24 base::android::ScopedJavaLocalRef<jobject> jbitmap) {
25 return jbitmap.is_null() 25 return jbitmap.is_null()
26 ? SkBitmap() 26 ? SkBitmap()
27 : CreateSkBitmapFromJavaBitmap(gfx::JavaBitmap(jbitmap.obj())); 27 : CreateSkBitmapFromJavaBitmap(gfx::JavaBitmap(jbitmap));
28 } 28 }
29 29
30 class HandleResources { 30 class HandleResources {
31 public: 31 public:
32 HandleResources() : loaded_(false) { 32 HandleResources() : loaded_(false) {
33 } 33 }
34 34
35 void LoadIfNecessary(const JavaRef<jobject>& context) { 35 void LoadIfNecessary(const JavaRef<jobject>& context) {
36 if (loaded_) 36 if (loaded_)
37 return; 37 return;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 void CompositedTouchHandleDrawable::DetachLayer() { 174 void CompositedTouchHandleDrawable::DetachLayer() {
175 layer_->RemoveFromParent(); 175 layer_->RemoveFromParent();
176 } 176 }
177 177
178 void CompositedTouchHandleDrawable::UpdateLayerPosition() { 178 void CompositedTouchHandleDrawable::UpdateLayerPosition() {
179 layer_->SetPosition(origin_position_); 179 layer_->SetPosition(origin_position_);
180 } 180 }
181 181
182 } // namespace content 182 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698