Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(692)

Side by Side Diff: components/content_settings/core/browser/host_content_settings_map.h

Issue 2158743002: Register a pref to control migration status (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@change_scoping_type
Patch Set: address review comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // Maps hostnames to custom content settings. Written on the UI thread and read 5 // Maps hostnames to custom content settings. Written on the UI thread and read
6 // on any thread. One instance per profile. 6 // on any thread. One instance per profile.
7 7
8 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ 8 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_
9 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ 9 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_
10 10
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 void RemoveObserver(content_settings::Observer* observer); 273 void RemoveObserver(content_settings::Observer* observer);
274 274
275 // Schedules any pending lossy website settings to be written to disk. 275 // Schedules any pending lossy website settings to be written to disk.
276 void FlushLossyWebsiteSettings(); 276 void FlushLossyWebsiteSettings();
277 277
278 // Passes ownership of |clock|. 278 // Passes ownership of |clock|.
279 void SetPrefClockForTesting(std::unique_ptr<base::Clock> clock); 279 void SetPrefClockForTesting(std::unique_ptr<base::Clock> clock);
280 280
281 private: 281 private:
282 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; 282 friend class base::RefCountedThreadSafe<HostContentSettingsMap>;
283 friend class HostContentSettingsMapTest_DomainToOriginMigrationStatus_Test;
283 friend class HostContentSettingsMapTest_MigrateDomainScopedSettings_Test; 284 friend class HostContentSettingsMapTest_MigrateDomainScopedSettings_Test;
284 friend class HostContentSettingsMapTest_MigrateKeygenSettings_Test; 285 friend class HostContentSettingsMapTest_MigrateKeygenSettings_Test;
285 286
286 friend class content_settings::TestUtils; 287 friend class content_settings::TestUtils;
287 288
288 typedef std::map<ProviderType, content_settings::ProviderInterface*> 289 typedef std::map<ProviderType, content_settings::ProviderInterface*>
289 ProviderMap; 290 ProviderMap;
290 typedef ProviderMap::iterator ProviderIterator; 291 typedef ProviderMap::iterator ProviderIterator;
291 typedef ProviderMap::const_iterator ConstProviderIterator; 292 typedef ProviderMap::const_iterator ConstProviderIterator;
292 293
(...skipping 16 matching lines...) Expand all
309 // settings to use ContentSettingsPattern::Wildcard(). This allows us to make 310 // settings to use ContentSettingsPattern::Wildcard(). This allows us to make
310 // the scoping code consistent across different settings. 311 // the scoping code consistent across different settings.
311 // TODO(lshang): Remove this when clients have migrated (~M53). We should 312 // TODO(lshang): Remove this when clients have migrated (~M53). We should
312 // leave in some code to remove old-format settings for a long time. 313 // leave in some code to remove old-format settings for a long time.
313 void MigrateKeygenSettings(); 314 void MigrateKeygenSettings();
314 315
315 // Migrate old domain scoped ALLOW settings to be origin scoped for 316 // Migrate old domain scoped ALLOW settings to be origin scoped for
316 // ContentSettingsTypes which are domain scoped. Only narrow down ALLOW 317 // ContentSettingsTypes which are domain scoped. Only narrow down ALLOW
317 // domain settings to origins so that this will not cause privacy/security 318 // domain settings to origins so that this will not cause privacy/security
318 // issues. 319 // issues.
320 // |after_sync| is false means the migration is done upon construction of the
raymes 2016/07/25 03:56:38 nit: put this on the previous line or in a new par
raymes 2016/07/25 03:56:38 nit: |after_sync| will be false when called upon c
lshang 2016/07/25 04:51:10 Done.
lshang 2016/07/25 04:51:10 Done.
321 // HostContentSettingsMap (before syncing any content settings), and is true
322 // means the migration is done after sync has finished.
319 // TODO(lshang): https://crbug.com/621398 Remove this when clients have 323 // TODO(lshang): https://crbug.com/621398 Remove this when clients have
320 // migrated (~M56). 324 // migrated (~M56).
321 void MigrateDomainScopedSettings(); 325 void MigrateDomainScopedSettings(bool after_sync);
322 326
323 // Collect UMA data about the number of exceptions. 327 // Collect UMA data about the number of exceptions.
324 void RecordNumberOfExceptions(); 328 void RecordNumberOfExceptions();
325 329
326 // Adds content settings for |content_type| and |resource_identifier|, 330 // Adds content settings for |content_type| and |resource_identifier|,
327 // provided by |provider|, into |settings|. If |incognito| is true, adds only 331 // provided by |provider|, into |settings|. If |incognito| is true, adds only
328 // the content settings which are applicable to the incognito mode and differ 332 // the content settings which are applicable to the incognito mode and differ
329 // from the normal mode. Otherwise, adds the content settings for the normal 333 // from the normal mode. Otherwise, adds the content settings for the normal
330 // mode. 334 // mode.
331 void AddSettingsForOneType( 335 void AddSettingsForOneType(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 content_settings::PrefProvider* pref_provider_ = nullptr; 397 content_settings::PrefProvider* pref_provider_ = nullptr;
394 398
395 base::ThreadChecker thread_checker_; 399 base::ThreadChecker thread_checker_;
396 400
397 base::ObserverList<content_settings::Observer> observers_; 401 base::ObserverList<content_settings::Observer> observers_;
398 402
399 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); 403 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap);
400 }; 404 };
401 405
402 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ 406 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698