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; | |
raymes
2015/10/14 02:07:04
nit: unused
Reilly Grant (use Gerrit)
2015/10/22 00:57:02
Done.
| |
18 class Value; | |
19 } | |
20 | |
21 class GURL; | |
22 class HostContentSettingsMap; | |
23 class Profile; | |
24 | |
25 class ChooserPermissionContextBase : public KeyedService { | |
raymes
2015/10/14 02:07:04
Since this is quite different from a PermissionCon
Reilly Grant (use Gerrit)
2015/10/22 00:57:02
Done.
| |
26 public: | |
raymes
2015/10/14 02:07:04
I think these should mostly be protected
Reilly Grant (use Gerrit)
2015/10/22 00:57:02
UI code will be calling these.
| |
27 using ObjectList = ScopedVector<base::DictionaryValue>; | |
raymes
2015/10/14 02:07:04
nit: I'm not sure if this adds a lot (someone read
Reilly Grant (use Gerrit)
2015/10/22 00:57:02
Done.
| |
28 | |
29 ChooserPermissionContextBase(Profile* profile, | |
30 ContentSettingsType permission_type, | |
31 ContentSettingsType chooser_settings_type); | |
32 ~ChooserPermissionContextBase() override; | |
33 | |
34 ObjectList GetPreviouslyChosenObjects(const GURL& requesting_origin, | |
35 const GURL& embedding_origin); | |
36 void GrantObjectPermission(const GURL& requesting_origin, | |
37 const GURL& embedding_origin, | |
38 scoped_ptr<base::DictionaryValue> object); | |
39 void RevokeObjectPermission(const GURL& requesting_origin, | |
40 const GURL& embedding_origin, | |
41 const base::DictionaryValue& object); | |
42 | |
43 virtual bool IsValidObject(const base::DictionaryValue& object) = 0; | |
44 virtual std::string GetStringToDisplayForObject( | |
raymes
2015/10/14 02:07:04
Is this for UI? - I think it would be better to se
Reilly Grant (use Gerrit)
2015/10/22 00:57:02
I would rather keep all the knowledge about what a
raymes
2015/10/29 06:14:40
I disagree - I left an extended comment in usb_cho
Reilly Grant (use Gerrit)
2015/10/29 20:59:59
Done.
| |
45 const base::DictionaryValue& object) = 0; | |
46 | |
47 private: | |
48 scoped_ptr<base::DictionaryValue> GetWebsiteSetting( | |
49 const GURL& requesting_origin, | |
50 const GURL& embedding_origin); | |
51 void SetWebsiteSetting(const GURL& requesting_origin, | |
52 const GURL& embedding_origin, | |
53 scoped_ptr<base::Value> value); | |
54 | |
55 HostContentSettingsMap* const host_content_settings_map_; | |
56 const ContentSettingsType permission_type_; | |
57 const ContentSettingsType chooser_settings_type_; | |
58 }; | |
59 | |
60 #endif // CHROME_BROWSER_PERMISSIONS_CHOOSER_PERMISSION_CONTEXT_BASE_H_ | |
OLD | NEW |