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/toolbar/toolbar_model_android.h" | 5 #include "chrome/browser/ui/android/toolbar/toolbar_model_android.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/search/search.h" | 9 #include "chrome/browser/search/search.h" |
10 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 10 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 content::WebContents* ToolbarModelAndroid::GetActiveWebContents() const { | 56 content::WebContents* ToolbarModelAndroid::GetActiveWebContents() const { |
57 JNIEnv* env = base::android::AttachCurrentThread(); | 57 JNIEnv* env = base::android::AttachCurrentThread(); |
58 ScopedJavaLocalRef<jobject> jdelegate = weak_java_delegate_.get(env); | 58 ScopedJavaLocalRef<jobject> jdelegate = weak_java_delegate_.get(env); |
59 if (!jdelegate.obj()) | 59 if (!jdelegate.obj()) |
60 return NULL; | 60 return NULL; |
61 ScopedJavaLocalRef<jobject> jweb_contents = | 61 ScopedJavaLocalRef<jobject> jweb_contents = |
62 Java_ToolbarModelDelegate_getActiveWebContents(env, jdelegate.obj()); | 62 Java_ToolbarModelDelegate_getActiveWebContents(env, jdelegate.obj()); |
63 return content::WebContents::FromJavaWebContents(jweb_contents.obj()); | 63 return content::WebContents::FromJavaWebContents(jweb_contents.obj()); |
64 } | 64 } |
65 | 65 |
66 bool ToolbarModelAndroid::InTabbedBrowser() const { | |
67 return true; | |
68 } | |
69 | |
70 // static | 66 // static |
71 bool ToolbarModelAndroid::RegisterToolbarModelAndroid(JNIEnv* env) { | 67 bool ToolbarModelAndroid::RegisterToolbarModelAndroid(JNIEnv* env) { |
72 return RegisterNativesImpl(env); | 68 return RegisterNativesImpl(env); |
73 } | 69 } |
74 | 70 |
75 // static | 71 // static |
76 jlong Init(JNIEnv* env, jobject obj, jobject delegate) { | 72 jlong Init(JNIEnv* env, jobject obj, jobject delegate) { |
77 ToolbarModelAndroid* toolbar_model = new ToolbarModelAndroid(env, delegate); | 73 ToolbarModelAndroid* toolbar_model = new ToolbarModelAndroid(env, delegate); |
78 return reinterpret_cast<intptr_t>(toolbar_model); | 74 return reinterpret_cast<intptr_t>(toolbar_model); |
79 } | 75 } |
80 | 76 |
81 // static | 77 // static |
82 jint GetSecurityLevelForWebContents(JNIEnv* env, | 78 jint GetSecurityLevelForWebContents(JNIEnv* env, |
83 jclass jcaller, | 79 jclass jcaller, |
84 jobject jweb_contents) { | 80 jobject jweb_contents) { |
85 content::WebContents* web_contents = | 81 content::WebContents* web_contents = |
86 content::WebContents::FromJavaWebContents(jweb_contents); | 82 content::WebContents::FromJavaWebContents(jweb_contents); |
87 DCHECK(web_contents); | 83 DCHECK(web_contents); |
88 return ToolbarModelImpl::GetSecurityLevelForWebContents(web_contents); | 84 return ToolbarModelImpl::GetSecurityLevelForWebContents(web_contents); |
89 } | 85 } |
OLD | NEW |