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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 102593002: Convert string16 to base::string16 in content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 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 "content/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 page_scale_factor_limits.y(), 382 page_scale_factor_limits.y(),
383 content_size.width(), 383 content_size.width(),
384 content_size.height(), 384 content_size.height(),
385 viewport_size.width(), 385 viewport_size.width(),
386 viewport_size.height(), 386 viewport_size.height(),
387 controls_offset.y(), 387 controls_offset.y(),
388 content_offset.y(), 388 content_offset.y(),
389 overdraw_bottom_height); 389 overdraw_bottom_height);
390 } 390 }
391 391
392 void ContentViewCoreImpl::SetTitle(const string16& title) { 392 void ContentViewCoreImpl::SetTitle(const base::string16& title) {
393 JNIEnv* env = AttachCurrentThread(); 393 JNIEnv* env = AttachCurrentThread();
394 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 394 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
395 if (obj.is_null()) 395 if (obj.is_null())
396 return; 396 return;
397 ScopedJavaLocalRef<jstring> jtitle = 397 ScopedJavaLocalRef<jstring> jtitle =
398 ConvertUTF8ToJavaString(env, UTF16ToUTF8(title)); 398 ConvertUTF8ToJavaString(env, UTF16ToUTF8(title));
399 Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj()); 399 Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj());
400 } 400 }
401 401
402 void ContentViewCoreImpl::OnBackgroundColorChanged(SkColor color) { 402 void ContentViewCoreImpl::OnBackgroundColorChanged(SkColor color) {
(...skipping 28 matching lines...) Expand all
431 env->SetIntArrayRegion(selected_array.obj(), 0, selected_count, 431 env->SetIntArrayRegion(selected_array.obj(), 0, selected_count,
432 native_selected_array.get()); 432 native_selected_array.get());
433 } else { 433 } else {
434 selected_array = ScopedJavaLocalRef<jintArray>(env, env->NewIntArray(1)); 434 selected_array = ScopedJavaLocalRef<jintArray>(env, env->NewIntArray(1));
435 jint value = selected_item; 435 jint value = selected_item;
436 env->SetIntArrayRegion(selected_array.obj(), 0, 1, &value); 436 env->SetIntArrayRegion(selected_array.obj(), 0, 1, &value);
437 } 437 }
438 438
439 ScopedJavaLocalRef<jintArray> enabled_array(env, 439 ScopedJavaLocalRef<jintArray> enabled_array(env,
440 env->NewIntArray(items.size())); 440 env->NewIntArray(items.size()));
441 std::vector<string16> labels; 441 std::vector<base::string16> labels;
442 labels.reserve(items.size()); 442 labels.reserve(items.size());
443 for (size_t i = 0; i < items.size(); ++i) { 443 for (size_t i = 0; i < items.size(); ++i) {
444 labels.push_back(items[i].label); 444 labels.push_back(items[i].label);
445 jint enabled = 445 jint enabled =
446 (items[i].type == MenuItem::GROUP ? POPUP_ITEM_TYPE_GROUP : 446 (items[i].type == MenuItem::GROUP ? POPUP_ITEM_TYPE_GROUP :
447 (items[i].enabled ? POPUP_ITEM_TYPE_ENABLED : 447 (items[i].enabled ? POPUP_ITEM_TYPE_ENABLED :
448 POPUP_ITEM_TYPE_DISABLED)); 448 POPUP_ITEM_TYPE_DISABLED));
449 env->SetIntArrayRegion(enabled_array.obj(), i, 1, &enabled); 449 env->SetIntArrayRegion(enabled_array.obj(), i, 1, &enabled);
450 } 450 }
451 ScopedJavaLocalRef<jobjectArray> items_array( 451 ScopedJavaLocalRef<jobjectArray> items_array(
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 1480
1481 if (start_renderer && !rvh->IsRenderViewLive()) { 1481 if (start_renderer && !rvh->IsRenderViewLive()) {
1482 if (!web_contents_->CreateRenderViewForInitialEmptyDocument()) { 1482 if (!web_contents_->CreateRenderViewForInitialEmptyDocument()) {
1483 LOG(ERROR) << "Failed to create RenderView in EvaluateJavaScript"; 1483 LOG(ERROR) << "Failed to create RenderView in EvaluateJavaScript";
1484 return; 1484 return;
1485 } 1485 }
1486 } 1486 }
1487 1487
1488 if (!callback) { 1488 if (!callback) {
1489 // No callback requested. 1489 // No callback requested.
1490 rvh->ExecuteJavascriptInWebFrame(string16(), // frame_xpath 1490 rvh->ExecuteJavascriptInWebFrame(base::string16(), // frame_xpath
1491 ConvertJavaStringToUTF16(env, script)); 1491 ConvertJavaStringToUTF16(env, script));
1492 return; 1492 return;
1493 } 1493 }
1494 1494
1495 // Secure the Java callback in a scoped object and give ownership of it to the 1495 // Secure the Java callback in a scoped object and give ownership of it to the
1496 // base::Callback. 1496 // base::Callback.
1497 ScopedJavaGlobalRef<jobject> j_callback; 1497 ScopedJavaGlobalRef<jobject> j_callback;
1498 j_callback.Reset(env, callback); 1498 j_callback.Reset(env, callback);
1499 content::RenderViewHost::JavascriptResultCallback c_callback = 1499 content::RenderViewHost::JavascriptResultCallback c_callback =
1500 base::Bind(&JavaScriptResultCallback, j_callback); 1500 base::Bind(&JavaScriptResultCallback, j_callback);
1501 1501
1502 rvh->ExecuteJavascriptInWebFrameCallbackResult( 1502 rvh->ExecuteJavascriptInWebFrameCallbackResult(
1503 string16(), // frame_xpath 1503 base::string16(), // frame_xpath
1504 ConvertJavaStringToUTF16(env, script), 1504 ConvertJavaStringToUTF16(env, script),
1505 c_callback); 1505 c_callback);
1506 } 1506 }
1507 1507
1508 bool ContentViewCoreImpl::GetUseDesktopUserAgent( 1508 bool ContentViewCoreImpl::GetUseDesktopUserAgent(
1509 JNIEnv* env, jobject obj) { 1509 JNIEnv* env, jobject obj) {
1510 NavigationEntry* entry = web_contents_->GetController().GetVisibleEntry(); 1510 NavigationEntry* entry = web_contents_->GetController().GetVisibleEntry();
1511 return entry && entry->GetIsOverridingUserAgent(); 1511 return entry && entry->GetIsOverridingUserAgent();
1512 } 1512 }
1513 1513
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 reinterpret_cast<ui::ViewAndroid*>(view_android), 1636 reinterpret_cast<ui::ViewAndroid*>(view_android),
1637 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1637 reinterpret_cast<ui::WindowAndroid*>(window_android));
1638 return reinterpret_cast<intptr_t>(view); 1638 return reinterpret_cast<intptr_t>(view);
1639 } 1639 }
1640 1640
1641 bool RegisterContentViewCore(JNIEnv* env) { 1641 bool RegisterContentViewCore(JNIEnv* env) {
1642 return RegisterNativesImpl(env); 1642 return RegisterNativesImpl(env);
1643 } 1643 }
1644 1644
1645 } // namespace content 1645 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/android/content_view_statics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698