Chromium Code Reviews| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 /** | 50 /** |
| 51 * Fetches preferences for all sites that have them. | 51 * Fetches preferences for all sites that have them. |
| 52 * TODO(mvanouwerkerk): Add an argument |url| to only fetch permissions for | 52 * TODO(mvanouwerkerk): Add an argument |url| to only fetch permissions for |
| 53 * sites from the same origin as that of |url| - https://crbug.com/459222. | 53 * sites from the same origin as that of |url| - https://crbug.com/459222. |
| 54 */ | 54 */ |
| 55 public void fetchAllPreferences() { | 55 public void fetchAllPreferences() { |
| 56 TaskQueue queue = new TaskQueue(); | 56 TaskQueue queue = new TaskQueue(); |
| 57 // Populate features from more specific to less specific. | 57 // Populate features from more specific to less specific. |
| 58 // Geolocation lookup permission is per-origin and per-embedder. | 58 // Geolocation lookup permission is per-origin and per-embedder. |
| 59 queue.add(new GeolocationInfoFetcher()); | 59 queue.add(new GeolocationInfoFetcher()); |
| 60 // Keygen permissions are per-origin. | |
|
newt (away)
2015/12/15 00:10:01
this needs to come after MidiInfoFetcher, as per t
svaldez
2015/12/15 21:45:56
Done.
| |
| 61 queue.add(new KeygenInfoFetcher()); | |
| 60 // Midi sysex access permission is per-origin and per-embedder. | 62 // Midi sysex access permission is per-origin and per-embedder. |
| 61 queue.add(new MidiInfoFetcher()); | 63 queue.add(new MidiInfoFetcher()); |
| 62 // Cookies are stored per-origin. | 64 // Cookies are stored per-origin. |
| 63 queue.add(new CookieInfoFetcher()); | 65 queue.add(new CookieInfoFetcher()); |
| 64 // Fullscreen are stored per-origin. | 66 // Fullscreen are stored per-origin. |
| 65 queue.add(new FullscreenInfoFetcher()); | 67 queue.add(new FullscreenInfoFetcher()); |
| 66 // Local storage info is per-origin. | 68 // Local storage info is per-origin. |
| 67 queue.add(new LocalStorageInfoFetcher()); | 69 queue.add(new LocalStorageInfoFetcher()); |
| 68 // Website storage is per-host. | 70 // Website storage is per-host. |
| 69 queue.add(new WebStorageInfoFetcher()); | 71 queue.add(new WebStorageInfoFetcher()); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 if (address == null) continue; | 240 if (address == null) continue; |
| 239 Set<Website> sites = findOrCreateSitesByHost(address); | 241 Set<Website> sites = findOrCreateSitesByHost(address); |
| 240 for (Website site : sites) { | 242 for (Website site : sites) { |
| 241 site.setJavaScriptException(exception); | 243 site.setJavaScriptException(exception); |
| 242 } | 244 } |
| 243 } | 245 } |
| 244 queue.next(); | 246 queue.next(); |
| 245 } | 247 } |
| 246 } | 248 } |
| 247 | 249 |
| 250 private class KeygenInfoFetcher implements Task { | |
| 251 @Override | |
| 252 public void run(TaskQueue queue) { | |
| 253 for (KeygenInfo info : WebsitePreferenceBridge.getKeygenInfo()) { | |
| 254 WebsiteAddress address = WebsiteAddress.create(info.getOrigin()) ; | |
| 255 if (address == null) continue; | |
| 256 createSiteByOriginAndHost(address).setKeygenInfo(info); | |
| 257 } | |
| 258 queue.next(); | |
| 259 } | |
| 260 } | |
| 261 | |
| 248 private class CookieInfoFetcher implements Task { | 262 private class CookieInfoFetcher implements Task { |
| 249 @Override | 263 @Override |
| 250 public void run(TaskQueue queue) { | 264 public void run(TaskQueue queue) { |
| 251 for (CookieInfo info : WebsitePreferenceBridge.getCookieInfo()) { | 265 for (CookieInfo info : WebsitePreferenceBridge.getCookieInfo()) { |
| 252 WebsiteAddress address = WebsiteAddress.create(info.getOrigin()) ; | 266 WebsiteAddress address = WebsiteAddress.create(info.getOrigin()) ; |
| 253 if (address == null) continue; | 267 if (address == null) continue; |
| 254 createSiteByOriginAndHost(address).setCookieInfo(info); | 268 createSiteByOriginAndHost(address).setCookieInfo(info); |
| 255 } | 269 } |
| 256 queue.next(); | 270 queue.next(); |
| 257 } | 271 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 } | 383 } |
| 370 | 384 |
| 371 private class PermissionsAvailableCallbackRunner implements Task { | 385 private class PermissionsAvailableCallbackRunner implements Task { |
| 372 @Override | 386 @Override |
| 373 public void run(TaskQueue queue) { | 387 public void run(TaskQueue queue) { |
| 374 mCallback.onWebsitePermissionsAvailable(mSitesByOrigin, mSitesByHost ); | 388 mCallback.onWebsitePermissionsAvailable(mSitesByOrigin, mSitesByHost ); |
| 375 queue.next(); | 389 queue.next(); |
| 376 } | 390 } |
| 377 } | 391 } |
| 378 } | 392 } |
| OLD | NEW |