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

Side by Side Diff: chrome/browser/permissions/chooser_context_base.h

Issue 1427433017: Add a "guard" content settings type for chooser permissions. Base URL: https://chromium.googlesource.com/chromium/src.git@permission_store
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/permissions/chooser_context_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 #ifndef CHROME_BROWSER_PERMISSIONS_CHOOSER_CONTEXT_BASE_H_ 5 #ifndef CHROME_BROWSER_PERMISSIONS_CHOOSER_CONTEXT_BASE_H_
6 #define CHROME_BROWSER_PERMISSIONS_CHOOSER_CONTEXT_BASE_H_ 6 #define CHROME_BROWSER_PERMISSIONS_CHOOSER_CONTEXT_BASE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "components/content_settings/core/common/content_settings_types.h" 12 #include "components/content_settings/core/common/content_settings_types.h"
13 #include "components/keyed_service/core/keyed_service.h" 13 #include "components/keyed_service/core/keyed_service.h"
14 14
15 namespace base { 15 namespace base {
16 class DictionaryValue; 16 class DictionaryValue;
17 class Value; 17 class Value;
18 } 18 }
19 19
20 class GURL; 20 class GURL;
21 class HostContentSettingsMap; 21 class HostContentSettingsMap;
22 class Profile; 22 class Profile;
23 23
24 // This is the base class for services that manage any type of permission that 24 // This is the base class for services that manage any type of permission that
25 // is granted through a chooser-style UI instead of a simple allow/deny prompt. 25 // is granted through a chooser-style UI instead of a simple allow/deny prompt.
26 // Subclasses must define the structure of the objects that are stored. 26 // Subclasses must define the structure of the objects that are stored.
27 class ChooserContextBase : public KeyedService { 27 class ChooserContextBase : public KeyedService {
28 public: 28 public:
29 ChooserContextBase(Profile* profile, 29 ChooserContextBase(Profile* profile,
30 ContentSettingsType guard_content_settings_type,
30 ContentSettingsType data_content_settings_type); 31 ContentSettingsType data_content_settings_type);
31 ~ChooserContextBase() override; 32 ~ChooserContextBase() override;
32 33
34 // Checks whether |requesting_origin| can request permission to access objects
35 // when embedded within |embedding_origin|. This is done by checking
36 // |guard_content_settings_type_| which will usually be allowed by default but
37 // could be overridden by group policy.
38 bool CanRequestObjectPermission(const GURL& requesting_origin,
39 const GURL& embedding_origin);
40
33 // Returns the list of objects that |requesting_origin| has been granted 41 // Returns the list of objects that |requesting_origin| has been granted
34 // permission to access when embedded within |embedding_origin|. 42 // permission to access when embedded within |embedding_origin|.
35 ScopedVector<base::DictionaryValue> GetGrantedObjects( 43 ScopedVector<base::DictionaryValue> GetGrantedObjects(
36 const GURL& requesting_origin, 44 const GURL& requesting_origin,
37 const GURL& embedding_origin); 45 const GURL& embedding_origin);
38 46
39 // Grants |requesting_origin| access to |object| when embedded within 47 // Grants |requesting_origin| access to |object| when embedded within
40 // |embedding_origin| by writing it into |host_content_settings_map_|. 48 // |embedding_origin| by writing it into |host_content_settings_map_|.
41 void GrantObjectPermission(const GURL& requesting_origin, 49 void GrantObjectPermission(const GURL& requesting_origin,
42 const GURL& embedding_origin, 50 const GURL& embedding_origin,
(...skipping 11 matching lines...) Expand all
54 62
55 private: 63 private:
56 scoped_ptr<base::DictionaryValue> GetWebsiteSetting( 64 scoped_ptr<base::DictionaryValue> GetWebsiteSetting(
57 const GURL& requesting_origin, 65 const GURL& requesting_origin,
58 const GURL& embedding_origin); 66 const GURL& embedding_origin);
59 void SetWebsiteSetting(const GURL& requesting_origin, 67 void SetWebsiteSetting(const GURL& requesting_origin,
60 const GURL& embedding_origin, 68 const GURL& embedding_origin,
61 scoped_ptr<base::Value> value); 69 scoped_ptr<base::Value> value);
62 70
63 HostContentSettingsMap* const host_content_settings_map_; 71 HostContentSettingsMap* const host_content_settings_map_;
72 const ContentSettingsType guard_content_settings_type_;
64 const ContentSettingsType data_content_settings_type_; 73 const ContentSettingsType data_content_settings_type_;
65 }; 74 };
66 75
67 #endif // CHROME_BROWSER_PERMISSIONS_CHOOSER_CONTEXT_BASE_H_ 76 #endif // CHROME_BROWSER_PERMISSIONS_CHOOSER_CONTEXT_BASE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/permissions/chooser_context_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698