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 android.util.Pair; | 7 import android.util.Pair; |
8 | 8 |
9 import org.chromium.base.Callback; | 9 import org.chromium.base.Callback; |
10 import org.chromium.chrome.browser.ContentSettingsType; | 10 import org.chromium.chrome.browser.ContentSettingsType; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 * TODO(mvanouwerkerk): Add an argument |url| to only fetch permissions for | 46 * TODO(mvanouwerkerk): Add an argument |url| to only fetch permissions for |
47 * sites from the same origin as that of |url| - https://crbug.com/459222. | 47 * sites from the same origin as that of |url| - https://crbug.com/459222. |
48 */ | 48 */ |
49 public void fetchAllPreferences() { | 49 public void fetchAllPreferences() { |
50 TaskQueue queue = new TaskQueue(); | 50 TaskQueue queue = new TaskQueue(); |
51 // Populate features from more specific to less specific. | 51 // Populate features from more specific to less specific. |
52 // Geolocation lookup permission is per-origin and per-embedder. | 52 // Geolocation lookup permission is per-origin and per-embedder. |
53 queue.add(new GeolocationInfoFetcher()); | 53 queue.add(new GeolocationInfoFetcher()); |
54 // Midi sysex access permission is per-origin and per-embedder. | 54 // Midi sysex access permission is per-origin and per-embedder. |
55 queue.add(new MidiInfoFetcher()); | 55 queue.add(new MidiInfoFetcher()); |
| 56 // Sensor access permission is per-origin and per-embedder. |
| 57 queue.add(new SensorInfoFetcher()); |
56 // Cookies are stored per-host. | 58 // Cookies are stored per-host. |
57 queue.add(new CookieExceptionInfoFetcher()); | 59 queue.add(new CookieExceptionInfoFetcher()); |
58 // Local storage info is per-origin. | 60 // Local storage info is per-origin. |
59 queue.add(new LocalStorageInfoFetcher()); | 61 queue.add(new LocalStorageInfoFetcher()); |
60 // Website storage is per-host. | 62 // Website storage is per-host. |
61 queue.add(new WebStorageInfoFetcher()); | 63 queue.add(new WebStorageInfoFetcher()); |
62 // Popup exceptions are host-based patterns (unless we start | 64 // Popup exceptions are host-based patterns (unless we start |
63 // synchronizing popup exceptions with desktop Chrome). | 65 // synchronizing popup exceptions with desktop Chrome). |
64 queue.add(new PopupExceptionInfoFetcher()); | 66 queue.add(new PopupExceptionInfoFetcher()); |
65 // Subresource filter exceptions are host-based. | 67 // Subresource filter exceptions are host-based. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 public void run() { | 249 public void run() { |
248 for (MidiInfo info : WebsitePreferenceBridge.getMidiInfo()) { | 250 for (MidiInfo info : WebsitePreferenceBridge.getMidiInfo()) { |
249 WebsiteAddress origin = WebsiteAddress.create(info.getOrigin()); | 251 WebsiteAddress origin = WebsiteAddress.create(info.getOrigin()); |
250 if (origin == null) continue; | 252 if (origin == null) continue; |
251 WebsiteAddress embedder = WebsiteAddress.create(info.getEmbedder
()); | 253 WebsiteAddress embedder = WebsiteAddress.create(info.getEmbedder
()); |
252 findOrCreateSite(origin, embedder).setMidiInfo(info); | 254 findOrCreateSite(origin, embedder).setMidiInfo(info); |
253 } | 255 } |
254 } | 256 } |
255 } | 257 } |
256 | 258 |
| 259 private class SensorInfoFetcher extends Task { |
| 260 @Override |
| 261 public void run() { |
| 262 for (SensorInfo info : WebsitePreferenceBridge.getSensorInfo()) { |
| 263 WebsiteAddress origin = WebsiteAddress.create(info.getOrigin()); |
| 264 if (origin == null) continue; |
| 265 WebsiteAddress embedder = WebsiteAddress.create(info.getEmbedder
()); |
| 266 findOrCreateSite(origin, embedder).setSensorInfo(info); |
| 267 } |
| 268 } |
| 269 } |
| 270 |
257 private class PopupExceptionInfoFetcher extends Task { | 271 private class PopupExceptionInfoFetcher extends Task { |
258 @Override | 272 @Override |
259 public void run() { | 273 public void run() { |
260 setException(ContentSettingsType.CONTENT_SETTINGS_TYPE_POPUPS); | 274 setException(ContentSettingsType.CONTENT_SETTINGS_TYPE_POPUPS); |
261 } | 275 } |
262 } | 276 } |
263 | 277 |
264 private class SubresourceFilterExceptionInfoFetcher extends Task { | 278 private class SubresourceFilterExceptionInfoFetcher extends Task { |
265 @Override | 279 @Override |
266 public void run() { | 280 public void run() { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 } | 404 } |
391 } | 405 } |
392 | 406 |
393 private class PermissionsAvailableCallbackRunner extends Task { | 407 private class PermissionsAvailableCallbackRunner extends Task { |
394 @Override | 408 @Override |
395 public void run() { | 409 public void run() { |
396 mCallback.onWebsitePermissionsAvailable(mSites.values()); | 410 mCallback.onWebsitePermissionsAvailable(mSites.values()); |
397 } | 411 } |
398 } | 412 } |
399 } | 413 } |
OLD | NEW |