OLD | NEW |
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 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
6 | 6 |
7 import android.content.ContentValues; | 7 import android.content.ContentValues; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.database.Cursor; | 9 import android.database.Cursor; |
10 import android.database.sqlite.SQLiteDatabase; | 10 import android.database.sqlite.SQLiteDatabase; |
(...skipping 14 matching lines...) Expand all Loading... |
25 * is handled in the dedicated background thread, which also provides a performa
nce gain | 25 * is handled in the dedicated background thread, which also provides a performa
nce gain |
26 * if triggered early on (e.g. as a side effect of CookieSyncManager.createInsta
nce() call), | 26 * if triggered early on (e.g. as a side effect of CookieSyncManager.createInsta
nce() call), |
27 * sufficiently in advance of the first blocking usage of the API. | 27 * sufficiently in advance of the first blocking usage of the API. |
28 */ | 28 */ |
29 public class HttpAuthDatabase { | 29 public class HttpAuthDatabase { |
30 | 30 |
31 private static final String LOGTAG = "HttpAuthDatabase"; | 31 private static final String LOGTAG = "HttpAuthDatabase"; |
32 | 32 |
33 private static final int DATABASE_VERSION = 1; | 33 private static final int DATABASE_VERSION = 1; |
34 | 34 |
35 private SQLiteDatabase mDatabase = null; | 35 private SQLiteDatabase mDatabase; |
36 | 36 |
37 private static final String ID_COL = "_id"; | 37 private static final String ID_COL = "_id"; |
38 | 38 |
39 private static final String[] ID_PROJECTION = new String[] { | 39 private static final String[] ID_PROJECTION = new String[] { |
40 ID_COL | 40 ID_COL |
41 }; | 41 }; |
42 | 42 |
43 // column id strings for "httpauth" table | 43 // column id strings for "httpauth" table |
44 private static final String HTTPAUTH_TABLE_NAME = "httpauth"; | 44 private static final String HTTPAUTH_TABLE_NAME = "httpauth"; |
45 private static final String HTTPAUTH_HOST_COL = "host"; | 45 private static final String HTTPAUTH_HOST_COL = "host"; |
46 private static final String HTTPAUTH_REALM_COL = "realm"; | 46 private static final String HTTPAUTH_REALM_COL = "realm"; |
47 private static final String HTTPAUTH_USERNAME_COL = "username"; | 47 private static final String HTTPAUTH_USERNAME_COL = "username"; |
48 private static final String HTTPAUTH_PASSWORD_COL = "password"; | 48 private static final String HTTPAUTH_PASSWORD_COL = "password"; |
49 | 49 |
50 /** | 50 /** |
51 * Initially false until the background thread completes. | 51 * Initially false until the background thread completes. |
52 */ | 52 */ |
53 private boolean mInitialized = false; | 53 private boolean mInitialized; |
54 | 54 |
55 private final Object mInitializedLock = new Object(); | 55 private final Object mInitializedLock = new Object(); |
56 | 56 |
57 /** | 57 /** |
58 * Creates and returns an instance of HttpAuthDatabase for the named file, a
nd kicks-off | 58 * Creates and returns an instance of HttpAuthDatabase for the named file, a
nd kicks-off |
59 * background initialization of that database. | 59 * background initialization of that database. |
60 * | 60 * |
61 * @param context the Context to use for opening the database | 61 * @param context the Context to use for opening the database |
62 * @param databaseFile Name of the file to be initialized. | 62 * @param databaseFile Name of the file to be initialized. |
63 */ | 63 */ |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 /** | 249 /** |
250 * Clears the HTTP authentication password database. | 250 * Clears the HTTP authentication password database. |
251 */ | 251 */ |
252 public void clearHttpAuthUsernamePassword() { | 252 public void clearHttpAuthUsernamePassword() { |
253 if (!waitForInit()) { | 253 if (!waitForInit()) { |
254 return; | 254 return; |
255 } | 255 } |
256 mDatabase.delete(HTTPAUTH_TABLE_NAME, null, null); | 256 mDatabase.delete(HTTPAUTH_TABLE_NAME, null, null); |
257 } | 257 } |
258 } | 258 } |
OLD | NEW |