Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 com.android.webview.chromium; | 5 package com.android.webview.chromium; |
| 6 | 6 |
| 7 import android.webkit.WebViewDatabase; | 7 import android.webkit.WebViewDatabase; |
| 8 | 8 |
| 9 import org.chromium.android_webview.AwFormDatabase; | 9 import org.chromium.android_webview.AwFormDatabase; |
| 10 import org.chromium.android_webview.HttpAuthDatabase; | 10 import org.chromium.android_webview.HttpAuthDatabase; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 public void run() { | 60 public void run() { |
| 61 mHttpAuthDatabase.clearHttpAuthUsernamePassword(); | 61 mHttpAuthDatabase.clearHttpAuthUsernamePassword(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 }); | 64 }); |
| 65 return; | 65 return; |
| 66 } | 66 } |
| 67 mHttpAuthDatabase.clearHttpAuthUsernamePassword(); | 67 mHttpAuthDatabase.clearHttpAuthUsernamePassword(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 // TODO(ntfschr): add @Override once this is added in Android (http://crbug. com/616583) | |
| 71 public void setHttpAuthUsernamePassword( | |
| 72 final String host, final String realm, final String username, final String password) { | |
| 73 if (checkNeedsPost()) { | |
| 74 mFactory.addTask(new Runnable() { | |
| 75 @Override | |
| 76 public void run() { | |
| 77 mHttpAuthDatabase.setHttpAuthUsernamePassword(host, realm, u sername, password); | |
| 78 } | |
| 79 }); | |
| 80 return; | |
| 81 } | |
| 82 mHttpAuthDatabase.setHttpAuthUsernamePassword(host, realm, username, pas sword); | |
| 83 } | |
| 84 | |
| 85 // TODO(ntfschr): add @Override once this is added in Android (http://crbug. com/616583) | |
|
sgurun-gerrit only
2016/09/23 23:26:47
Note that this can only happen after releasing the
Nate Fischer
2016/09/23 23:29:44
I'll update that to be more explicit.
| |
| 86 public String[] getHttpAuthUsernamePassword(final String host, final String realm) { | |
| 87 if (checkNeedsPost()) { | |
| 88 return mFactory.runOnUiThreadBlocking(new Callable<String[]>() { | |
| 89 @Override | |
| 90 public String[] call() { | |
| 91 return mHttpAuthDatabase.getHttpAuthUsernamePassword(host, r ealm); | |
| 92 } | |
| 93 }); | |
| 94 } | |
| 95 return mHttpAuthDatabase.getHttpAuthUsernamePassword(host, realm); | |
| 96 } | |
| 97 | |
| 70 @Override | 98 @Override |
| 71 public boolean hasFormData() { | 99 public boolean hasFormData() { |
| 72 if (checkNeedsPost()) { | 100 if (checkNeedsPost()) { |
| 73 return mFactory.runOnUiThreadBlocking(new Callable<Boolean>() { | 101 return mFactory.runOnUiThreadBlocking(new Callable<Boolean>() { |
| 74 @Override | 102 @Override |
| 75 public Boolean call() { | 103 public Boolean call() { |
| 76 return AwFormDatabase.hasFormData(); | 104 return AwFormDatabase.hasFormData(); |
| 77 } | 105 } |
| 78 | 106 |
| 79 }); | 107 }); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 95 } | 123 } |
| 96 AwFormDatabase.clearFormData(); | 124 AwFormDatabase.clearFormData(); |
| 97 } | 125 } |
| 98 | 126 |
| 99 private static boolean checkNeedsPost() { | 127 private static boolean checkNeedsPost() { |
| 100 // Init is guaranteed to have happened if a WebViewDatabaseAdapter is cr eated, so do not | 128 // Init is guaranteed to have happened if a WebViewDatabaseAdapter is cr eated, so do not |
| 101 // need to check WebViewChromiumFactoryProvider.hasStarted. | 129 // need to check WebViewChromiumFactoryProvider.hasStarted. |
| 102 return !ThreadUtils.runningOnUiThread(); | 130 return !ThreadUtils.runningOnUiThread(); |
| 103 } | 131 } |
| 104 } | 132 } |
| OLD | NEW |