| OLD | NEW |
| 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 "chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h" | 5 #include "chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 11 #include "base/android/jni_weak_ref.h" | 11 #include "base/android/jni_weak_ref.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "chrome/browser/android/tab_android.h" | 14 #include "chrome/browser/android/tab_android.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/profiles/profile_android.h" | 17 #include "chrome/browser/profiles/profile_android.h" |
| 18 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 19 #include "chrome/browser/tab_contents/tab_util.h" | 19 #include "chrome/browser/tab_contents/tab_util.h" |
| 20 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" | 20 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" |
| 21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 22 #include "jni/TabModelJniBridge_jni.h" | 22 #include "jni/TabModelJniBridge_jni.h" |
| 23 | 23 |
| 24 using base::android::AttachCurrentThread; | 24 using base::android::AttachCurrentThread; |
| 25 using base::android::ConvertUTF8ToJavaString; | 25 using base::android::ConvertUTF8ToJavaString; |
| 26 using base::android::JavaParamRef; |
| 27 using base::android::ScopedJavaLocalRef; |
| 26 using content::WebContents; | 28 using content::WebContents; |
| 27 | 29 |
| 28 namespace { | 30 namespace { |
| 29 | 31 |
| 30 static Profile* FindProfile(jboolean is_incognito) { | 32 static Profile* FindProfile(jboolean is_incognito) { |
| 31 if (g_browser_process == NULL || | 33 if (g_browser_process == NULL || |
| 32 g_browser_process->profile_manager() == NULL) { | 34 g_browser_process->profile_manager() == NULL) { |
| 33 LOG(ERROR) << "Browser process or profile manager not initialized"; | 35 LOG(ERROR) << "Browser process or profile manager not initialized"; |
| 34 return NULL; | 36 return NULL; |
| 35 } | 37 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 bool TabModelJniBridge::Register(JNIEnv* env) { | 221 bool TabModelJniBridge::Register(JNIEnv* env) { |
| 220 return RegisterNativesImpl(env); | 222 return RegisterNativesImpl(env); |
| 221 } | 223 } |
| 222 | 224 |
| 223 static jlong Init(JNIEnv* env, | 225 static jlong Init(JNIEnv* env, |
| 224 const JavaParamRef<jobject>& obj, | 226 const JavaParamRef<jobject>& obj, |
| 225 jboolean is_incognito) { | 227 jboolean is_incognito) { |
| 226 TabModel* tab_model = new TabModelJniBridge(env, obj, is_incognito); | 228 TabModel* tab_model = new TabModelJniBridge(env, obj, is_incognito); |
| 227 return reinterpret_cast<intptr_t>(tab_model); | 229 return reinterpret_cast<intptr_t>(tab_model); |
| 228 } | 230 } |
| OLD | NEW |