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

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

Issue 11411229: [Android] Implement WebSettings.setAppCache{Enabled|Path} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed Created 8 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 (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 "content/browser/android/content_settings.h" 5 #include "content/browser/android/content_settings.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 "content/browser/android/content_view_core_impl.h" 9 #include "content/browser/android/content_view_core_impl.h"
10 #include "content/browser/renderer_host/render_view_host_delegate.h" 10 #include "content/browser/renderer_host/render_view_host_delegate.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 241
242 env->SetBooleanField( 242 env->SetBooleanField(
243 obj, 243 obj,
244 field_ids_->support_multiple_windows, 244 field_ids_->support_multiple_windows,
245 prefs.supports_multiple_windows); 245 prefs.supports_multiple_windows);
246 CheckException(env); 246 CheckException(env);
247 247
248 Java_ContentSettings_setPluginsDisabled(env, obj, !prefs.plugins_enabled); 248 Java_ContentSettings_setPluginsDisabled(env, obj, !prefs.plugins_enabled);
249 CheckException(env); 249 CheckException(env);
250 250
251 // We don't need to sync AppCache settings to Java, because there are
252 // no getters for them in the API.
253
251 env->SetBooleanField( 254 env->SetBooleanField(
252 obj, 255 obj,
253 field_ids_->dom_storage_enabled, 256 field_ids_->dom_storage_enabled,
254 prefs.local_storage_enabled); 257 prefs.local_storage_enabled);
255 CheckException(env); 258 CheckException(env);
256 } 259 }
257 260
258 void ContentSettings::SyncToNativeImpl() { 261 void ContentSettings::SyncToNativeImpl() {
259 JNIEnv* env = base::android::AttachCurrentThread(); 262 JNIEnv* env = base::android::AttachCurrentThread();
260 CHECK(env); 263 CHECK(env);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 obj, field_ids_->allow_file_access_from_file_urls); 347 obj, field_ids_->allow_file_access_from_file_urls);
345 348
346 prefs.javascript_can_open_windows_automatically = env->GetBooleanField( 349 prefs.javascript_can_open_windows_automatically = env->GetBooleanField(
347 obj, field_ids_->java_script_can_open_windows_automatically); 350 obj, field_ids_->java_script_can_open_windows_automatically);
348 351
349 prefs.supports_multiple_windows = env->GetBooleanField( 352 prefs.supports_multiple_windows = env->GetBooleanField(
350 obj, field_ids_->support_multiple_windows); 353 obj, field_ids_->support_multiple_windows);
351 354
352 prefs.plugins_enabled = !Java_ContentSettings_getPluginsDisabled(env, obj); 355 prefs.plugins_enabled = !Java_ContentSettings_getPluginsDisabled(env, obj);
353 356
357 prefs.application_cache_enabled =
358 Java_ContentSettings_getAppCacheEnabled(env, obj);
359
354 prefs.local_storage_enabled = env->GetBooleanField( 360 prefs.local_storage_enabled = env->GetBooleanField(
355 obj, field_ids_->dom_storage_enabled); 361 obj, field_ids_->dom_storage_enabled);
356 362
357 render_view_host->UpdateWebkitPreferences(prefs); 363 render_view_host->UpdateWebkitPreferences(prefs);
358 } 364 }
359 365
360 void ContentSettings::SyncFromNative(JNIEnv* env, jobject obj) { 366 void ContentSettings::SyncFromNative(JNIEnv* env, jobject obj) {
361 SyncFromNativeImpl(); 367 SyncFromNativeImpl();
362 } 368 }
363 369
(...skipping 19 matching lines...) Expand all
383 new ContentSettings(env, obj, web_contents, is_master_mode); 389 new ContentSettings(env, obj, web_contents, is_master_mode);
384 return reinterpret_cast<jint>(content_settings); 390 return reinterpret_cast<jint>(content_settings);
385 } 391 }
386 392
387 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { 393 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) {
388 return base::android::ConvertUTF8ToJavaString( 394 return base::android::ConvertUTF8ToJavaString(
389 env, GetContentClient()->GetUserAgent()).Release(); 395 env, GetContentClient()->GetUserAgent()).Release();
390 } 396 }
391 397
392 } // namespace content 398 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698