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

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

Issue 2237943002: Remove now-unnecessary .obj() in Java method calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@switch-context
Patch Set: Rebase *again* :( Created 4 years, 4 months 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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_web_contents_delegate_android.h" 5 #include "chrome/browser/android/tab_web_contents_delegate_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.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"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 blink::WebDisplayMode TabWebContentsDelegateAndroid::GetDisplayMode( 176 blink::WebDisplayMode TabWebContentsDelegateAndroid::GetDisplayMode(
177 const WebContents* web_contents) const { 177 const WebContents* web_contents) const {
178 JNIEnv* env = base::android::AttachCurrentThread(); 178 JNIEnv* env = base::android::AttachCurrentThread();
179 179
180 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); 180 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
181 if (obj.is_null()) 181 if (obj.is_null())
182 return blink::WebDisplayModeUndefined; 182 return blink::WebDisplayModeUndefined;
183 183
184 return static_cast<blink::WebDisplayMode>( 184 return static_cast<blink::WebDisplayMode>(
185 Java_TabWebContentsDelegateAndroid_getDisplayMode( 185 Java_TabWebContentsDelegateAndroid_getDisplayMode(env, obj));
186 env, obj.obj()));
187 } 186 }
188 187
189 void TabWebContentsDelegateAndroid::FindReply( 188 void TabWebContentsDelegateAndroid::FindReply(
190 WebContents* web_contents, 189 WebContents* web_contents,
191 int request_id, 190 int request_id,
192 int number_of_matches, 191 int number_of_matches,
193 const gfx::Rect& selection_rect, 192 const gfx::Rect& selection_rect,
194 int active_match_ordinal, 193 int active_match_ordinal,
195 bool final_update) { 194 bool final_update) {
196 if (!notification_registrar_.IsRegistered(this, 195 if (!notification_registrar_.IsRegistered(this,
(...skipping 19 matching lines...) Expand all
216 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); 215 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
217 if (obj.is_null()) 216 if (obj.is_null())
218 return; 217 return;
219 218
220 ScopedJavaLocalRef<jobject> selection_rect = CreateJavaRect( 219 ScopedJavaLocalRef<jobject> selection_rect = CreateJavaRect(
221 env, find_result->selection_rect()); 220 env, find_result->selection_rect());
222 221
223 // Create the details object. 222 // Create the details object.
224 ScopedJavaLocalRef<jobject> details_object = 223 ScopedJavaLocalRef<jobject> details_object =
225 Java_TabWebContentsDelegateAndroid_createFindNotificationDetails( 224 Java_TabWebContentsDelegateAndroid_createFindNotificationDetails(
226 env, 225 env, find_result->number_of_matches(), selection_rect,
227 find_result->number_of_matches(), 226 find_result->active_match_ordinal(), find_result->final_update());
228 selection_rect.obj(),
229 find_result->active_match_ordinal(),
230 find_result->final_update());
231 227
232 Java_TabWebContentsDelegateAndroid_onFindResultAvailable( 228 Java_TabWebContentsDelegateAndroid_onFindResultAvailable(env, obj,
233 env, 229 details_object);
234 obj.obj(),
235 details_object.obj());
236 } 230 }
237 231
238 void TabWebContentsDelegateAndroid::FindMatchRectsReply( 232 void TabWebContentsDelegateAndroid::FindMatchRectsReply(
239 WebContents* web_contents, 233 WebContents* web_contents,
240 int version, 234 int version,
241 const std::vector<gfx::RectF>& rects, 235 const std::vector<gfx::RectF>& rects,
242 const gfx::RectF& active_rect) { 236 const gfx::RectF& active_rect) {
243 JNIEnv* env = base::android::AttachCurrentThread(); 237 JNIEnv* env = base::android::AttachCurrentThread();
244 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); 238 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
245 if (obj.is_null()) 239 if (obj.is_null())
246 return; 240 return;
247 241
248 // Create the details object. 242 // Create the details object.
249 ScopedJavaLocalRef<jobject> details_object = 243 ScopedJavaLocalRef<jobject> details_object =
250 Java_TabWebContentsDelegateAndroid_createFindMatchRectsDetails( 244 Java_TabWebContentsDelegateAndroid_createFindMatchRectsDetails(
251 env, 245 env, version, rects.size(), CreateJavaRectF(env, active_rect));
252 version,
253 rects.size(),
254 CreateJavaRectF(env, active_rect).obj());
255 246
256 // Add the rects 247 // Add the rects
257 for (size_t i = 0; i < rects.size(); ++i) { 248 for (size_t i = 0; i < rects.size(); ++i) {
258 Java_TabWebContentsDelegateAndroid_setMatchRectByIndex( 249 Java_TabWebContentsDelegateAndroid_setMatchRectByIndex(
259 env, 250 env, details_object, i, CreateJavaRectF(env, rects[i]));
260 details_object.obj(),
261 i,
262 CreateJavaRectF(env, rects[i]).obj());
263 } 251 }
264 252
265 Java_TabWebContentsDelegateAndroid_onFindMatchRectsAvailable( 253 Java_TabWebContentsDelegateAndroid_onFindMatchRectsAvailable(env, obj,
266 env, 254 details_object);
267 obj.obj(),
268 details_object.obj());
269 } 255 }
270 256
271 content::JavaScriptDialogManager* 257 content::JavaScriptDialogManager*
272 TabWebContentsDelegateAndroid::GetJavaScriptDialogManager( 258 TabWebContentsDelegateAndroid::GetJavaScriptDialogManager(
273 WebContents* source) { 259 WebContents* source) {
274 return app_modal::JavaScriptDialogManager::GetInstance(); 260 return app_modal::JavaScriptDialogManager::GetInstance();
275 } 261 }
276 262
277 void TabWebContentsDelegateAndroid::RequestMediaAccessPermission( 263 void TabWebContentsDelegateAndroid::RequestMediaAccessPermission(
278 content::WebContents* web_contents, 264 content::WebContents* web_contents,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 return WebContentsDelegateAndroid::OpenURLFromTab(source, params); 351 return WebContentsDelegateAndroid::OpenURLFromTab(source, params);
366 } 352 }
367 353
368 bool TabWebContentsDelegateAndroid::ShouldResumeRequestsForCreatedWindow() { 354 bool TabWebContentsDelegateAndroid::ShouldResumeRequestsForCreatedWindow() {
369 JNIEnv* env = base::android::AttachCurrentThread(); 355 JNIEnv* env = base::android::AttachCurrentThread();
370 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); 356 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
371 if (obj.is_null()) 357 if (obj.is_null())
372 return true; 358 return true;
373 359
374 return Java_TabWebContentsDelegateAndroid_shouldResumeRequestsForCreatedWindow ( 360 return Java_TabWebContentsDelegateAndroid_shouldResumeRequestsForCreatedWindow (
375 env, 361 env, obj);
376 obj.obj());
377 } 362 }
378 363
379 void TabWebContentsDelegateAndroid::AddNewContents( 364 void TabWebContentsDelegateAndroid::AddNewContents(
380 WebContents* source, 365 WebContents* source,
381 WebContents* new_contents, 366 WebContents* new_contents,
382 WindowOpenDisposition disposition, 367 WindowOpenDisposition disposition,
383 const gfx::Rect& initial_rect, 368 const gfx::Rect& initial_rect,
384 bool user_gesture, 369 bool user_gesture,
385 bool* was_blocked) { 370 bool* was_blocked) {
386 // No code for this yet. 371 // No code for this yet.
387 DCHECK_NE(disposition, SAVE_TO_DISK); 372 DCHECK_NE(disposition, SAVE_TO_DISK);
388 // Can't create a new contents for the current tab - invalid case. 373 // Can't create a new contents for the current tab - invalid case.
389 DCHECK_NE(disposition, CURRENT_TAB); 374 DCHECK_NE(disposition, CURRENT_TAB);
390 375
391 TabHelpers::AttachTabHelpers(new_contents); 376 TabHelpers::AttachTabHelpers(new_contents);
392 377
393 JNIEnv* env = AttachCurrentThread(); 378 JNIEnv* env = AttachCurrentThread();
394 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); 379 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
395 bool handled = false; 380 bool handled = false;
396 if (!obj.is_null()) { 381 if (!obj.is_null()) {
397 ScopedJavaLocalRef<jobject> jsource; 382 ScopedJavaLocalRef<jobject> jsource;
398 if (source) 383 if (source)
399 jsource = source->GetJavaWebContents(); 384 jsource = source->GetJavaWebContents();
400 ScopedJavaLocalRef<jobject> jnew_contents; 385 ScopedJavaLocalRef<jobject> jnew_contents;
401 if (new_contents) 386 if (new_contents)
402 jnew_contents = new_contents->GetJavaWebContents(); 387 jnew_contents = new_contents->GetJavaWebContents();
403 388
404 handled = Java_TabWebContentsDelegateAndroid_addNewContents( 389 handled = Java_TabWebContentsDelegateAndroid_addNewContents(
405 env, 390 env, obj, jsource, jnew_contents, static_cast<jint>(disposition),
406 obj.obj(), 391 nullptr, user_gesture);
407 jsource.obj(),
408 jnew_contents.obj(),
409 static_cast<jint>(disposition),
410 nullptr,
411 user_gesture);
412 } 392 }
413 393
414 if (was_blocked) 394 if (was_blocked)
415 *was_blocked = !handled; 395 *was_blocked = !handled;
416 if (!handled) 396 if (!handled)
417 delete new_contents; 397 delete new_contents;
418 } 398 }
419 399
420 void TabWebContentsDelegateAndroid::RequestAppBannerFromDevTools( 400 void TabWebContentsDelegateAndroid::RequestAppBannerFromDevTools(
421 content::WebContents* web_contents) { 401 content::WebContents* web_contents) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 jboolean IsCapturingVideo(JNIEnv* env, 457 jboolean IsCapturingVideo(JNIEnv* env,
478 const JavaParamRef<jclass>& clazz, 458 const JavaParamRef<jclass>& clazz,
479 const JavaParamRef<jobject>& java_web_contents) { 459 const JavaParamRef<jobject>& java_web_contents) {
480 content::WebContents* web_contents = 460 content::WebContents* web_contents =
481 content::WebContents::FromJavaWebContents(java_web_contents); 461 content::WebContents::FromJavaWebContents(java_web_contents);
482 scoped_refptr<MediaStreamCaptureIndicator> indicator = 462 scoped_refptr<MediaStreamCaptureIndicator> indicator =
483 MediaCaptureDevicesDispatcher::GetInstance()-> 463 MediaCaptureDevicesDispatcher::GetInstance()->
484 GetMediaStreamCaptureIndicator(); 464 GetMediaStreamCaptureIndicator();
485 return indicator->IsCapturingVideo(web_contents); 465 return indicator->IsCapturingVideo(web_contents);
486 } 466 }
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.cc ('k') | chrome/browser/android/webapk/manifest_upgrade_detector_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698