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 "blimp/client/app/android/tab_control_feature_android.h" | 5 #include "blimp/client/app/android/tab_control_feature_android.h" |
6 | 6 |
7 #include "blimp/client/app/android/blimp_client_session_android.h" | 7 #include "blimp/client/app/android/blimp_client_session_android.h" |
8 #include "blimp/client/core/contents/tab_control_feature.h" | 8 #include "blimp/client/core/contents/tab_control_feature.h" |
9 #include "jni/TabControlFeature_jni.h" | 9 #include "jni/TabControlFeature_jni.h" |
10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
11 | 11 |
12 using base::android::JavaParamRef; | |
13 | |
14 namespace blimp { | 12 namespace blimp { |
15 namespace client { | 13 namespace client { |
16 | 14 |
17 static jlong Init(JNIEnv* env, | 15 static jlong Init( |
18 const JavaParamRef<jobject>& jobj, | 16 JNIEnv* env, |
19 const JavaParamRef<jobject>& blimp_client_session) { | 17 const base::android::JavaParamRef<jobject>& jobj, |
| 18 const base::android::JavaParamRef<jobject>& blimp_client_session) { |
20 BlimpClientSession* client_session = | 19 BlimpClientSession* client_session = |
21 BlimpClientSessionAndroid::FromJavaObject(env, blimp_client_session); | 20 BlimpClientSessionAndroid::FromJavaObject(env, blimp_client_session); |
22 | 21 |
23 return reinterpret_cast<intptr_t>( | 22 return reinterpret_cast<intptr_t>( |
24 new TabControlFeatureAndroid(env, | 23 new TabControlFeatureAndroid(env, |
25 jobj, | 24 jobj, |
26 client_session->GetTabControlFeature())); | 25 client_session->GetTabControlFeature())); |
27 } | 26 } |
28 | 27 |
29 // static | 28 // static |
30 bool TabControlFeatureAndroid::RegisterJni(JNIEnv* env) { | 29 bool TabControlFeatureAndroid::RegisterJni(JNIEnv* env) { |
31 return RegisterNativesImpl(env); | 30 return RegisterNativesImpl(env); |
32 } | 31 } |
33 | 32 |
34 TabControlFeatureAndroid::TabControlFeatureAndroid( | 33 TabControlFeatureAndroid::TabControlFeatureAndroid( |
35 JNIEnv* env, | 34 JNIEnv* env, |
36 const base::android::JavaParamRef<jobject>& jobj, | 35 const base::android::JavaParamRef<jobject>& jobj, |
37 TabControlFeature* tab_control_feature) | 36 TabControlFeature* tab_control_feature) |
38 : tab_control_feature_(tab_control_feature) { | 37 : tab_control_feature_(tab_control_feature) { |
39 java_obj_.Reset(env, jobj); | 38 java_obj_.Reset(env, jobj); |
40 } | 39 } |
41 | 40 |
42 TabControlFeatureAndroid::~TabControlFeatureAndroid() {} | 41 TabControlFeatureAndroid::~TabControlFeatureAndroid() {} |
43 | 42 |
44 void TabControlFeatureAndroid::Destroy(JNIEnv* env, | 43 void TabControlFeatureAndroid::Destroy( |
45 const JavaParamRef<jobject>& jobj) { | 44 JNIEnv* env, |
| 45 const base::android::JavaParamRef<jobject>& jobj) { |
46 delete this; | 46 delete this; |
47 } | 47 } |
48 | 48 |
49 void TabControlFeatureAndroid::OnContentAreaSizeChanged( | 49 void TabControlFeatureAndroid::OnContentAreaSizeChanged( |
50 JNIEnv* env, | 50 JNIEnv* env, |
51 const JavaParamRef<jobject>& jobj, | 51 const base::android::JavaParamRef<jobject>& jobj, |
52 jint width, | 52 jint width, |
53 jint height, | 53 jint height, |
54 jfloat dp_to_px) { | 54 jfloat dp_to_px) { |
55 tab_control_feature_->SetSizeAndScale(gfx::Size(width, height), dp_to_px); | 55 tab_control_feature_->SetSizeAndScale(gfx::Size(width, height), dp_to_px); |
56 } | 56 } |
57 | 57 |
58 } // namespace client | 58 } // namespace client |
59 } // namespace blimp | 59 } // namespace blimp |
OLD | NEW |