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

Side by Side Diff: chrome/browser/android/tab_android.cc

Issue 67573003: Android: moves chrome/ to use long for JNI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tab_android.h" 5 #include "chrome/browser/android/tab_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" 9 #include "chrome/browser/android/chrome_web_contents_delegate_android.h"
10 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" 10 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 TabAndroid* TabAndroid::GetNativeTab(JNIEnv* env, jobject obj) { 141 TabAndroid* TabAndroid::GetNativeTab(JNIEnv* env, jobject obj) {
142 return reinterpret_cast<TabAndroid*>(Java_TabBase_getNativePtr(env, obj)); 142 return reinterpret_cast<TabAndroid*>(Java_TabBase_getNativePtr(env, obj));
143 } 143 }
144 144
145 TabAndroid::TabAndroid(JNIEnv* env, jobject obj) 145 TabAndroid::TabAndroid(JNIEnv* env, jobject obj)
146 : weak_java_tab_(env, obj), 146 : weak_java_tab_(env, obj),
147 session_tab_id_(), 147 session_tab_id_(),
148 synced_tab_delegate_(new browser_sync::SyncedTabDelegateAndroid(this)) { 148 synced_tab_delegate_(new browser_sync::SyncedTabDelegateAndroid(this)) {
149 Java_TabBase_setNativePtr(env, obj, reinterpret_cast<jint>(this)); 149 Java_TabBase_setNativePtr(env, obj, reinterpret_cast<intptr_t>(this));
150 } 150 }
151 151
152 TabAndroid::~TabAndroid() { 152 TabAndroid::~TabAndroid() {
153 JNIEnv* env = base::android::AttachCurrentThread(); 153 JNIEnv* env = base::android::AttachCurrentThread();
154 ScopedJavaLocalRef<jobject> obj = weak_java_tab_.get(env); 154 ScopedJavaLocalRef<jobject> obj = weak_java_tab_.get(env);
155 if (obj.is_null()) 155 if (obj.is_null())
156 return; 156 return;
157 157
158 Java_TabBase_clearNativePtr(env, obj.obj()); 158 Java_TabBase_clearNativePtr(env, obj.obj());
159 } 159 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 env, 237 env,
238 weak_java_tab_.get(env).obj())); 238 weak_java_tab_.get(env).obj()));
239 InfoBarService* new_infobar_service = new_contents ? 239 InfoBarService* new_infobar_service = new_contents ?
240 InfoBarService::FromWebContents(new_contents) : NULL; 240 InfoBarService::FromWebContents(new_contents) : NULL;
241 if (new_infobar_service) 241 if (new_infobar_service)
242 infobar_container->ChangeInfoBarService(new_infobar_service); 242 infobar_container->ChangeInfoBarService(new_infobar_service);
243 243
244 Java_TabBase_swapWebContents( 244 Java_TabBase_swapWebContents(
245 env, 245 env,
246 weak_java_tab_.get(env).obj(), 246 weak_java_tab_.get(env).obj(),
247 reinterpret_cast<jint>(new_contents)); 247 reinterpret_cast<intptr_t>(new_contents));
248 } 248 }
249 249
250 void TabAndroid::Observe(int type, 250 void TabAndroid::Observe(int type,
251 const content::NotificationSource& source, 251 const content::NotificationSource& source,
252 const content::NotificationDetails& details) { 252 const content::NotificationDetails& details) {
253 JNIEnv* env = base::android::AttachCurrentThread(); 253 JNIEnv* env = base::android::AttachCurrentThread();
254 switch (type) { 254 switch (type) {
255 case chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED: { 255 case chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED: {
256 TabSpecificContentSettings* settings = 256 TabSpecificContentSettings* settings =
257 TabSpecificContentSettings::FromWebContents(web_contents()); 257 TabSpecificContentSettings::FromWebContents(web_contents());
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 395
396 content::NavigationEntry* entry = 396 content::NavigationEntry* entry =
397 web_contents()->GetController().GetVisibleEntry(); 397 web_contents()->GetController().GetVisibleEntry();
398 if (entry && url == entry->GetVirtualURL().spec()) 398 if (entry && url == entry->GetVirtualURL().spec())
399 entry->SetTitle(title); 399 entry->SetTitle(title);
400 } 400 }
401 401
402 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 402 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
403 return RegisterNativesImpl(env); 403 return RegisterNativesImpl(env);
404 } 404 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698