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

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, 4 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_MigrateDomainScopedSettings_Test; 283
284 friend class HostContentSettingsMapTest_MigrateKeygenSettings_Test; 284 FRIEND_TEST_ALL_PREFIXES(HostContentSettingsMapTest,
285 DomainToOriginMigrationStatus);
286 FRIEND_TEST_ALL_PREFIXES(HostContentSettingsMapTest,
287 MigrateDomainScopedSettings);
288 FRIEND_TEST_ALL_PREFIXES(HostContentSettingsMapTest, MigrateKeygenSettings);
285 289
286 friend class content_settings::TestUtils; 290 friend class content_settings::TestUtils;
287 291
288 typedef std::map<ProviderType, content_settings::ProviderInterface*> 292 typedef std::map<ProviderType, content_settings::ProviderInterface*>
289 ProviderMap; 293 ProviderMap;
290 typedef ProviderMap::iterator ProviderIterator; 294 typedef ProviderMap::iterator ProviderIterator;
291 typedef ProviderMap::const_iterator ConstProviderIterator; 295 typedef ProviderMap::const_iterator ConstProviderIterator;
292 296
293 ~HostContentSettingsMap() override; 297 ~HostContentSettingsMap() override;
294 298
(...skipping 14 matching lines...) Expand all
309 // settings to use ContentSettingsPattern::Wildcard(). This allows us to make 313 // settings to use ContentSettingsPattern::Wildcard(). This allows us to make
310 // the scoping code consistent across different settings. 314 // the scoping code consistent across different settings.
311 // TODO(lshang): Remove this when clients have migrated (~M53). We should 315 // 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. 316 // leave in some code to remove old-format settings for a long time.
313 void MigrateKeygenSettings(); 317 void MigrateKeygenSettings();
314 318
315 // Migrate old domain scoped ALLOW settings to be origin scoped for 319 // Migrate old domain scoped ALLOW settings to be origin scoped for
316 // ContentSettingsTypes which are domain scoped. Only narrow down ALLOW 320 // ContentSettingsTypes which are domain scoped. Only narrow down ALLOW
317 // domain settings to origins so that this will not cause privacy/security 321 // domain settings to origins so that this will not cause privacy/security
318 // issues. 322 // issues.
323 //
324 // |after_sync| will be false when called upon construction of this object and
325 // true when called by the sync layer after sync is completed.
319 // TODO(lshang): https://crbug.com/621398 Remove this when clients have 326 // TODO(lshang): https://crbug.com/621398 Remove this when clients have
320 // migrated (~M56). 327 // migrated (~M56).
321 void MigrateDomainScopedSettings(); 328 void MigrateDomainScopedSettings(bool after_sync);
322 329
323 // Collect UMA data about the number of exceptions. 330 // Collect UMA data about the number of exceptions.
324 void RecordNumberOfExceptions(); 331 void RecordNumberOfExceptions();
325 332
326 // Adds content settings for |content_type| and |resource_identifier|, 333 // Adds content settings for |content_type| and |resource_identifier|,
327 // provided by |provider|, into |settings|. If |incognito| is true, adds only 334 // provided by |provider|, into |settings|. If |incognito| is true, adds only
328 // the content settings which are applicable to the incognito mode and differ 335 // 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 336 // from the normal mode. Otherwise, adds the content settings for the normal
330 // mode. 337 // mode.
331 void AddSettingsForOneType( 338 void AddSettingsForOneType(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 content_settings::PrefProvider* pref_provider_ = nullptr; 400 content_settings::PrefProvider* pref_provider_ = nullptr;
394 401
395 base::ThreadChecker thread_checker_; 402 base::ThreadChecker thread_checker_;
396 403
397 base::ObserverList<content_settings::Observer> observers_; 404 base::ObserverList<content_settings::Observer> observers_;
398 405
399 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); 406 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap);
400 }; 407 };
401 408
402 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ 409 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698