OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PERMISSIONS_CHOOSER_PERMISSION_CONTEXT_BASE_H_ |
| 6 #define CHROME_BROWSER_PERMISSIONS_CHOOSER_PERMISSION_CONTEXT_BASE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/scoped_vector.h" |
| 12 #include "components/content_settings/core/common/content_settings_types.h" |
| 13 #include "components/keyed_service/core/keyed_service.h" |
| 14 |
| 15 namespace base { |
| 16 class DictionaryValue; |
| 17 class ListValue; |
| 18 class Value; |
| 19 } |
| 20 |
| 21 namespace content { |
| 22 enum class PermissionType; |
| 23 } |
| 24 |
| 25 class GURL; |
| 26 class Profile; |
| 27 |
| 28 class ChooserPermissionContextBase : public KeyedService { |
| 29 public: |
| 30 using ObjectList = ScopedVector<base::DictionaryValue>; |
| 31 |
| 32 ChooserPermissionContextBase(Profile* profile, |
| 33 content::PermissionType permission_type, |
| 34 ContentSettingsType chooser_settings_type); |
| 35 ~ChooserPermissionContextBase() override; |
| 36 |
| 37 ObjectList GetPreviouslyChosenObjects(const GURL& requesting_origin, |
| 38 const GURL& embedding_origin); |
| 39 void GrantObjectPermission(const GURL& requesting_origin, |
| 40 const GURL& embedding_origin, |
| 41 scoped_ptr<base::DictionaryValue> object); |
| 42 void RevokeObjectPermission(const GURL& requesting_origin, |
| 43 const GURL& embedding_origin, |
| 44 const base::DictionaryValue& object); |
| 45 |
| 46 virtual bool IsValidObject(const base::DictionaryValue& object) = 0; |
| 47 virtual std::string GetStringToDisplayForObject( |
| 48 const base::DictionaryValue& object) = 0; |
| 49 |
| 50 private: |
| 51 scoped_ptr<base::DictionaryValue> GetWebsiteSetting( |
| 52 const GURL& requesting_origin, |
| 53 const GURL& embedding_origin); |
| 54 void SetWebsiteSetting(const GURL& requesting_origin, |
| 55 const GURL& embedding_origin, |
| 56 scoped_ptr<base::Value> value); |
| 57 |
| 58 Profile* const profile_; |
| 59 const content::PermissionType permission_type_; |
| 60 const ContentSettingsType chooser_settings_type_; |
| 61 }; |
| 62 |
| 63 #endif // CHROME_BROWSER_PERMISSIONS_CHOOSER_PERMISSION_CONTEXT_BASE_H_ |
OLD | NEW |