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/bottombar/overlay_panel_content.h" | 5 #include "chrome/browser/android/bottombar/overlay_panel_content.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 // This class manages the native behavior of the panel. | 41 // This class manages the native behavior of the panel. |
42 // Instances of this class are owned by the Java OverlayPanelContentl. | 42 // Instances of this class are owned by the Java OverlayPanelContentl. |
43 OverlayPanelContent::OverlayPanelContent(JNIEnv* env, jobject obj) { | 43 OverlayPanelContent::OverlayPanelContent(JNIEnv* env, jobject obj) { |
44 java_manager_.Reset(env, obj); | 44 java_manager_.Reset(env, obj); |
45 } | 45 } |
46 | 46 |
47 OverlayPanelContent::~OverlayPanelContent() { | 47 OverlayPanelContent::~OverlayPanelContent() { |
48 JNIEnv* env = base::android::AttachCurrentThread(); | 48 JNIEnv* env = base::android::AttachCurrentThread(); |
49 Java_OverlayPanelContent_clearNativePanelContentPtr( | 49 Java_OverlayPanelContent_clearNativePanelContentPtr(env, java_manager_); |
50 env, java_manager_.obj()); | |
51 } | 50 } |
52 | 51 |
53 void OverlayPanelContent::Destroy(JNIEnv* env, | 52 void OverlayPanelContent::Destroy(JNIEnv* env, |
54 const JavaParamRef<jobject>& obj) { | 53 const JavaParamRef<jobject>& obj) { |
55 delete this; | 54 delete this; |
56 } | 55 } |
57 | 56 |
58 void OverlayPanelContent::RemoveLastHistoryEntry( | 57 void OverlayPanelContent::RemoveLastHistoryEntry( |
59 JNIEnv* env, | 58 JNIEnv* env, |
60 const JavaParamRef<jobject>& obj, | 59 const JavaParamRef<jobject>& obj, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 135 } |
137 | 136 |
138 bool RegisterOverlayPanelContent(JNIEnv* env) { | 137 bool RegisterOverlayPanelContent(JNIEnv* env) { |
139 return RegisterNativesImpl(env); | 138 return RegisterNativesImpl(env); |
140 } | 139 } |
141 | 140 |
142 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 141 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
143 OverlayPanelContent* content = new OverlayPanelContent(env, obj); | 142 OverlayPanelContent* content = new OverlayPanelContent(env, obj); |
144 return reinterpret_cast<intptr_t>(content); | 143 return reinterpret_cast<intptr_t>(content); |
145 } | 144 } |
OLD | NEW |