diff options
-rw-r--r-- | res/values-pl/cm_strings.xml | 1 | ||||
-rw-r--r-- | res/values-zh-rTW/cm_strings.xml | 26 | ||||
-rw-r--r-- | src/com/android/browser/provider/BrowserProvider2.java | 28 |
3 files changed, 55 insertions, 0 deletions
diff --git a/res/values-pl/cm_strings.xml b/res/values-pl/cm_strings.xml index da4692c..7de80e3 100644 --- a/res/values-pl/cm_strings.xml +++ b/res/values-pl/cm_strings.xml @@ -18,6 +18,7 @@ <string name="pref_content_ua_summary">Wybierz sposób identyfikacji przeglądarki</string> <string name="pref_lab_webgl">WebGL</string> <string name="pref_lab_webgl_summary">Aktywuj WebGL</string> + <string name="contextmenu_openlink_incognito_newwindow">Otwórz w nowej karcie incognito</string> <string name="contextmenu_openlink_incognito_newwindow_background">Otwórz w nowej karcie incognito w tle</string> <string name="accessibility_button_homescreen">Ekran główny</string> <string name="pref_lab_websockets">WebSocket</string> diff --git a/res/values-zh-rTW/cm_strings.xml b/res/values-zh-rTW/cm_strings.xml new file mode 100644 index 0000000..860872f --- /dev/null +++ b/res/values-zh-rTW/cm_strings.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="contextmenu_openlink_incognito_newwindow">在新無痕式分頁中開啟</string> + <string name="contextmenu_openlink_incognito_newwindow_background">在新無痕式背景分頁中開啟</string> + <string name="pref_content_ua">用戶代理</string> + <string name="pref_content_ua_summary">選擇一個用戶代理</string> + <string name="pref_lab_webgl">WebGL</string> + <string name="pref_lab_webgl_summary">啟用WebGL</string> + <string name="pref_lab_websockets">WebSockets</string> + <string name="pref_lab_websockets_summary">啟用WebSockets</string> + <string name="accessibility_button_homescreen">首頁</string> +</resources> diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java index 014a32d..b76cb9f 100644 --- a/src/com/android/browser/provider/BrowserProvider2.java +++ b/src/com/android/browser/provider/BrowserProvider2.java @@ -32,10 +32,12 @@ import android.database.ContentObserver; import android.database.Cursor; import android.database.DatabaseUtils; import android.database.MatrixCursor; +import android.database.MemoryCursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteQueryBuilder; import android.net.Uri; +import android.os.Binder; import android.provider.BaseColumns; import android.provider.Browser; import android.provider.Browser.BookmarkColumns; @@ -52,6 +54,7 @@ import android.provider.BrowserContract.SyncState; import android.provider.ContactsContract.RawContacts; import android.provider.SyncStateContract; import android.text.TextUtils; +import android.util.Log; import com.android.browser.R; import com.android.browser.UrlUtils; @@ -68,6 +71,8 @@ import java.util.HashMap; public class BrowserProvider2 extends SQLiteContentProvider { + private static final String TAG = "BrowserProvider2"; + public static final String PARAM_GROUP_BY = "groupBy"; public static final String PARAM_ALLOW_EMPTY_ACCOUNTS = "allowEmptyAccounts"; @@ -876,6 +881,20 @@ public class BrowserProvider2 extends SQLiteContentProvider { @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { + Cursor c = queryInternal(uri, projection, selection, selectionArgs, sortOrder); + + if (getContext().isPrivacyGuardEnabled()) { + Log.d(TAG, "Browser query from application using privacy guard! pid=" + Binder.getCallingPid()); + MemoryCursor mc = new MemoryCursor(null, c.getColumnNames()); + c.close(); + return mc; + } + + return c; + } + + private Cursor queryInternal(Uri uri, String[] projection, String selection, String[] selectionArgs, + String sortOrder) { SQLiteDatabase db = mOpenHelper.getReadableDatabase(); final int match = URI_MATCHER.match(uri); SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); @@ -1222,6 +1241,9 @@ public class BrowserProvider2 extends SQLiteContentProvider { @Override public int deleteInTransaction(Uri uri, String selection, String[] selectionArgs, boolean callerIsSyncAdapter) { + if (getContext().isPrivacyGuardEnabled()) { + return 0; + } final int match = URI_MATCHER.match(uri); final SQLiteDatabase db = mOpenHelper.getWritableDatabase(); int deleted = 0; @@ -1365,6 +1387,9 @@ public class BrowserProvider2 extends SQLiteContentProvider { @Override public Uri insertInTransaction(Uri uri, ContentValues values, boolean callerIsSyncAdapter) { + if (getContext().isPrivacyGuardEnabled()) { + return null; + } int match = URI_MATCHER.match(uri); final SQLiteDatabase db = mOpenHelper.getWritableDatabase(); long id = -1; @@ -1615,6 +1640,9 @@ public class BrowserProvider2 extends SQLiteContentProvider { @Override public int updateInTransaction(Uri uri, ContentValues values, String selection, String[] selectionArgs, boolean callerIsSyncAdapter) { + if (getContext().isPrivacyGuardEnabled()) { + return 0; + } int match = URI_MATCHER.match(uri); final SQLiteDatabase db = mOpenHelper.getWritableDatabase(); if (match == LEGACY || match == LEGACY_ID) { |