OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.chrome.browser.preferences.website; | 5 package org.chromium.chrome.browser.preferences.website; |
6 | 6 |
7 import org.chromium.chrome.browser.ContentSettingsType; | 7 import org.chromium.chrome.browser.ContentSettingsType; |
8 | 8 |
9 import java.util.ArrayList; | 9 import java.util.ArrayList; |
10 import java.util.HashMap; | 10 import java.util.HashMap; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 queue.add(new FullscreenInfoFetcher()); | 65 queue.add(new FullscreenInfoFetcher()); |
66 // Local storage info is per-origin. | 66 // Local storage info is per-origin. |
67 queue.add(new LocalStorageInfoFetcher()); | 67 queue.add(new LocalStorageInfoFetcher()); |
68 // Website storage is per-host. | 68 // Website storage is per-host. |
69 queue.add(new WebStorageInfoFetcher()); | 69 queue.add(new WebStorageInfoFetcher()); |
70 // Popup exceptions are host-based patterns (unless we start | 70 // Popup exceptions are host-based patterns (unless we start |
71 // synchronizing popup exceptions with desktop Chrome.) | 71 // synchronizing popup exceptions with desktop Chrome.) |
72 queue.add(new PopupExceptionInfoFetcher()); | 72 queue.add(new PopupExceptionInfoFetcher()); |
73 // JavaScript exceptions are host-based patterns. | 73 // JavaScript exceptions are host-based patterns. |
74 queue.add(new JavaScriptExceptionInfoFetcher()); | 74 queue.add(new JavaScriptExceptionInfoFetcher()); |
75 // Keygen exceptions are host-based patterns. | |
76 queue.add(new KeygenExceptionInfoFetcher()); | |
75 // Protected media identifier permission is per-origin and per-embedder. | 77 // Protected media identifier permission is per-origin and per-embedder. |
76 queue.add(new ProtectedMediaIdentifierInfoFetcher()); | 78 queue.add(new ProtectedMediaIdentifierInfoFetcher()); |
77 // Push notification permission is per-origin and per-embedder. | 79 // Push notification permission is per-origin and per-embedder. |
78 queue.add(new PushNotificationInfoFetcher()); | 80 queue.add(new PushNotificationInfoFetcher()); |
79 // Camera capture permission is per-origin and per-embedder. | 81 // Camera capture permission is per-origin and per-embedder. |
80 queue.add(new CameraCaptureInfoFetcher()); | 82 queue.add(new CameraCaptureInfoFetcher()); |
81 // Micropohone capture permission is per-origin and per-embedder. | 83 // Micropohone capture permission is per-origin and per-embedder. |
82 queue.add(new MicrophoneCaptureInfoFetcher()); | 84 queue.add(new MicrophoneCaptureInfoFetcher()); |
83 queue.add(new PermissionsAvailableCallbackRunner()); | 85 queue.add(new PermissionsAvailableCallbackRunner()); |
84 queue.next(); | 86 queue.next(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 } else if (category.showMicrophoneSites()) { | 119 } else if (category.showMicrophoneSites()) { |
118 // Micropohone capture permission is per-origin and per-embedder. | 120 // Micropohone capture permission is per-origin and per-embedder. |
119 queue.add(new MicrophoneCaptureInfoFetcher()); | 121 queue.add(new MicrophoneCaptureInfoFetcher()); |
120 } else if (category.showPopupSites()) { | 122 } else if (category.showPopupSites()) { |
121 // Popup exceptions are host-based patterns (unless we start | 123 // Popup exceptions are host-based patterns (unless we start |
122 // synchronizing popup exceptions with desktop Chrome.) | 124 // synchronizing popup exceptions with desktop Chrome.) |
123 queue.add(new PopupExceptionInfoFetcher()); | 125 queue.add(new PopupExceptionInfoFetcher()); |
124 } else if (category.showJavaScriptSites()) { | 126 } else if (category.showJavaScriptSites()) { |
125 // JavaScript exceptions are host-based patterns. | 127 // JavaScript exceptions are host-based patterns. |
126 queue.add(new JavaScriptExceptionInfoFetcher()); | 128 queue.add(new JavaScriptExceptionInfoFetcher()); |
129 } else if (category.showKeygenSites()) { | |
130 // Keygen exceptions are host-based patterns. | |
131 queue.add(new KeygenExceptionInfoFetcher()); | |
Finnur
2015/11/05 20:44:41
This is only required if you have a specific first
svaldez
2015/11/10 15:25:02
Done.
| |
127 } else if (category.showNotificationsSites()) { | 132 } else if (category.showNotificationsSites()) { |
128 // Push notification permission is per-origin and per-embedder. | 133 // Push notification permission is per-origin and per-embedder. |
129 queue.add(new PushNotificationInfoFetcher()); | 134 queue.add(new PushNotificationInfoFetcher()); |
130 } else if (category.showProtectedMediaSites()) { | 135 } else if (category.showProtectedMediaSites()) { |
131 // Protected media identifier permission is per-origin and per-embed der. | 136 // Protected media identifier permission is per-origin and per-embed der. |
132 queue.add(new ProtectedMediaIdentifierInfoFetcher()); | 137 queue.add(new ProtectedMediaIdentifierInfoFetcher()); |
133 } | 138 } |
134 queue.add(new PermissionsAvailableCallbackRunner()); | 139 queue.add(new PermissionsAvailableCallbackRunner()); |
135 queue.next(); | 140 queue.next(); |
136 } | 141 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 if (address == null) continue; | 243 if (address == null) continue; |
239 Set<Website> sites = findOrCreateSitesByHost(address); | 244 Set<Website> sites = findOrCreateSitesByHost(address); |
240 for (Website site : sites) { | 245 for (Website site : sites) { |
241 site.setJavaScriptException(exception); | 246 site.setJavaScriptException(exception); |
242 } | 247 } |
243 } | 248 } |
244 queue.next(); | 249 queue.next(); |
245 } | 250 } |
246 } | 251 } |
247 | 252 |
253 private class KeygenExceptionInfoFetcher implements Task { | |
254 @Override | |
255 public void run(TaskQueue queue) { | |
256 for (ContentSettingException exception : | |
257 WebsitePreferenceBridge.getContentSettingsExceptions( | |
258 ContentSettingsType.CONTENT_SETTINGS_TYPE_KEYGEN)) { | |
259 // The pattern "*" represents the default setting, not a specifi c website. | |
260 if (exception.getPattern().equals("*")) continue; | |
261 WebsiteAddress address = WebsiteAddress.create(exception.getPatt ern()); | |
262 if (address == null) continue; | |
263 Set<Website> sites = findOrCreateSitesByHost(address); | |
264 for (Website site : sites) { | |
265 site.setKeygenException(exception); | |
266 } | |
267 } | |
268 queue.next(); | |
269 } | |
270 } | |
271 | |
248 private class CookieInfoFetcher implements Task { | 272 private class CookieInfoFetcher implements Task { |
249 @Override | 273 @Override |
250 public void run(TaskQueue queue) { | 274 public void run(TaskQueue queue) { |
251 for (CookieInfo info : WebsitePreferenceBridge.getCookieInfo()) { | 275 for (CookieInfo info : WebsitePreferenceBridge.getCookieInfo()) { |
252 WebsiteAddress address = WebsiteAddress.create(info.getOrigin()) ; | 276 WebsiteAddress address = WebsiteAddress.create(info.getOrigin()) ; |
253 if (address == null) continue; | 277 if (address == null) continue; |
254 createSiteByOriginAndHost(address).setCookieInfo(info); | 278 createSiteByOriginAndHost(address).setCookieInfo(info); |
255 } | 279 } |
256 queue.next(); | 280 queue.next(); |
257 } | 281 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
369 } | 393 } |
370 | 394 |
371 private class PermissionsAvailableCallbackRunner implements Task { | 395 private class PermissionsAvailableCallbackRunner implements Task { |
372 @Override | 396 @Override |
373 public void run(TaskQueue queue) { | 397 public void run(TaskQueue queue) { |
374 mCallback.onWebsitePermissionsAvailable(mSitesByOrigin, mSitesByHost ); | 398 mCallback.onWebsitePermissionsAvailable(mSitesByOrigin, mSitesByHost ); |
375 queue.next(); | 399 queue.next(); |
376 } | 400 } |
377 } | 401 } |
378 } | 402 } |
OLD | NEW |