test_page_specific_content_settings_delegate.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_CONTENT_SETTINGS_BROWSER_TEST_PAGE_SPECIFIC_CONTENT_SETTINGS_DELEGATE_H_
  5. #define COMPONENTS_CONTENT_SETTINGS_BROWSER_TEST_PAGE_SPECIFIC_CONTENT_SETTINGS_DELEGATE_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "base/memory/scoped_refptr.h"
  8. #include "components/content_settings/browser/page_specific_content_settings.h"
  9. namespace content_settings {
  10. class TestPageSpecificContentSettingsDelegate
  11. : public PageSpecificContentSettings::Delegate {
  12. public:
  13. TestPageSpecificContentSettingsDelegate(PrefService* prefs,
  14. HostContentSettingsMap* settings_map);
  15. ~TestPageSpecificContentSettingsDelegate() override;
  16. // PageSpecificContentSettings::Delegate:
  17. void UpdateLocationBar() override;
  18. PrefService* GetPrefs() override;
  19. HostContentSettingsMap* GetSettingsMap() override;
  20. void SetDefaultRendererContentSettingRules(
  21. content::RenderFrameHost* rfh,
  22. RendererContentSettingRules* rules) override;
  23. std::vector<storage::FileSystemType> GetAdditionalFileSystemTypes() override;
  24. browsing_data::CookieHelper::IsDeletionDisabledCallback
  25. GetIsDeletionDisabledCallback() override;
  26. bool IsMicrophoneCameraStateChanged(
  27. PageSpecificContentSettings::MicrophoneCameraState
  28. microphone_camera_state,
  29. const std::string& media_stream_selected_audio_device,
  30. const std::string& media_stream_selected_video_device) override;
  31. PageSpecificContentSettings::MicrophoneCameraState GetMicrophoneCameraState()
  32. override;
  33. void OnContentAllowed(ContentSettingsType type) override;
  34. void OnContentBlocked(ContentSettingsType type) override;
  35. void OnStorageAccessAllowed(
  36. content_settings::mojom::ContentSettingsManager::StorageType storage_type,
  37. const url::Origin& origin,
  38. content::Page& page) override;
  39. void OnCookieAccessAllowed(const net::CookieList& accessed_cookies,
  40. content::Page& page) override;
  41. void OnServiceWorkerAccessAllowed(const url::Origin& origin,
  42. content::Page& page) override;
  43. private:
  44. raw_ptr<PrefService> prefs_;
  45. scoped_refptr<HostContentSettingsMap> settings_map_;
  46. };
  47. } // namespace content_settings
  48. #endif // COMPONENTS_CONTENT_SETTINGS_BROWSER_TEST_PAGE_SPECIFIC_CONTENT_SETTINGS_DELEGATE_H_