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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/ContentSettings.java

Issue 11090003: [Android] Upstream WebView.allow{Content|File}Access implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update comments in AwSettings.java Created 8 years, 2 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 | 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 package org.chromium.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.os.Handler; 7 import android.os.Handler;
8 import android.os.Looper; 8 import android.os.Looper;
9 import android.os.Message; 9 import android.os.Message;
10 import android.webkit.WebSettings.PluginState; 10 import android.webkit.WebSettings.PluginState;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 private int mDefaultFontSize = 16; 80 private int mDefaultFontSize = 16;
81 private int mDefaultFixedFontSize = 13; 81 private int mDefaultFixedFontSize = 13;
82 private boolean mLoadsImagesAutomatically = true; 82 private boolean mLoadsImagesAutomatically = true;
83 private boolean mImagesEnabled = true; 83 private boolean mImagesEnabled = true;
84 private boolean mJavaScriptEnabled = false; 84 private boolean mJavaScriptEnabled = false;
85 private boolean mAllowUniversalAccessFromFileURLs = false; 85 private boolean mAllowUniversalAccessFromFileURLs = false;
86 private boolean mAllowFileAccessFromFileURLs = false; 86 private boolean mAllowFileAccessFromFileURLs = false;
87 private boolean mJavaScriptCanOpenWindowsAutomatically = false; 87 private boolean mJavaScriptCanOpenWindowsAutomatically = false;
88 private PluginState mPluginState = PluginState.OFF; 88 private PluginState mPluginState = PluginState.OFF;
89 private boolean mDomStorageEnabled = false; 89 private boolean mDomStorageEnabled = false;
90 private boolean mAllowFileUrlAccess = true;
91 private boolean mAllowContentUrlAccess = true;
92 90
93 // Not accessed by the native side. 91 // Not accessed by the native side.
94 private String mDefaultUserAgent = ""; 92 private String mDefaultUserAgent = "";
95 private boolean mSupportZoom = true; 93 private boolean mSupportZoom = true;
96 private boolean mBuiltInZoomControls = false; 94 private boolean mBuiltInZoomControls = false;
97 private boolean mDisplayZoomControls = true; 95 private boolean mDisplayZoomControls = true;
98 96
99 // Class to handle messages to be processed on the UI thread. 97 // Class to handle messages to be processed on the UI thread.
100 private class EventHandler { 98 private class EventHandler {
101 // Message id for syncing 99 // Message id for syncing
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 * the built-in zoom mechanisms. 338 * the built-in zoom mechanisms.
341 * 339 *
342 * @return true if the WebView displays on-screen zoom controls when using 340 * @return true if the WebView displays on-screen zoom controls when using
343 * the built-in zoom mechanisms 341 * the built-in zoom mechanisms
344 * @see #setDisplayZoomControls 342 * @see #setDisplayZoomControls
345 */ 343 */
346 public boolean getDisplayZoomControls() { 344 public boolean getDisplayZoomControls() {
347 return mDisplayZoomControls; 345 return mDisplayZoomControls;
348 } 346 }
349 347
350 /**
351 * Enables or disables file access within ContentView. File access is enable d by
352 * default. Note that this enables or disables file system access only.
353 * Assets and resources are still accessible using file:///android_asset and
354 * file:///android_res.
355 */
356 public void setAllowFileAccess(boolean allow) {
357 assert mCanModifySettings;
358 synchronized (mContentSettingsLock) {
359 if (mAllowFileUrlAccess != allow) {
360 mAllowFileUrlAccess = allow;
361 mEventHandler.syncSettingsLocked();
362 }
363 }
364 }
365
366 /**
367 * Gets whether this ContentView supports file access.
368 *
369 * @see #setAllowFileAccess
370 */
371 public boolean getAllowFileAccess() {
372 synchronized (mContentSettingsLock) {
373 return mAllowFileUrlAccess;
374 }
375 }
376
377 /**
378 * Enables or disables content URL access within ContentView. Content URL
379 * access allows ContentView to load content from a content provider install ed
380 * in the system. The default is enabled.
381 */
382 public void setAllowContentAccess(boolean allow) {
383 assert mCanModifySettings;
384 synchronized (mContentSettingsLock) {
385 if (mAllowContentUrlAccess != allow) {
386 mAllowContentUrlAccess = allow;
387 mEventHandler.syncSettingsLocked();
388 }
389 }
390 }
391
392 /**
393 * Gets whether this ContentView supports content URL access.
394 *
395 * @see #setAllowContentAccess
396 */
397 public boolean getAllowContentAccess() {
398 synchronized (mContentSettingsLock) {
399 return mAllowContentUrlAccess;
400 }
401 }
402
403 boolean supportsMultiTouchZoom() { 348 boolean supportsMultiTouchZoom() {
404 return mSupportZoom && mBuiltInZoomControls; 349 return mSupportZoom && mBuiltInZoomControls;
405 } 350 }
406 351
407 boolean shouldDisplayZoomControls() { 352 boolean shouldDisplayZoomControls() {
408 return supportsMultiTouchZoom() && mDisplayZoomControls; 353 return supportsMultiTouchZoom() && mDisplayZoomControls;
409 } 354 }
410 355
411 /** 356 /**
412 * Set the standard font family name. 357 * Set the standard font family name.
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 private static native void nativeDestroy(int nativeContentSettings); 944 private static native void nativeDestroy(int nativeContentSettings);
1000 945
1001 private static native String nativeGetDefaultUserAgent(); 946 private static native String nativeGetDefaultUserAgent();
1002 947
1003 // Synchronize Java settings from native settings. 948 // Synchronize Java settings from native settings.
1004 private native void nativeSyncFromNative(int nativeContentSettings); 949 private native void nativeSyncFromNative(int nativeContentSettings);
1005 950
1006 // Synchronize native settings from Java settings. 951 // Synchronize native settings from Java settings.
1007 private native void nativeSyncToNative(int nativeContentSettings); 952 private native void nativeSyncToNative(int nativeContentSettings);
1008 } 953 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698