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

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

Issue 1382783002: Store USB device permissions in website settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More chooser, less permission. Created 5 years, 2 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
(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_CONTEXT_BASE_H_
6 #define CHROME_BROWSER_PERMISSIONS_CHOOSER_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 Value;
18 }
19
20 class GURL;
21 class HostContentSettingsMap;
22 class Profile;
23
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.
26 // Subclasses must define the structure of the objects that are stored and how
27 // they are displayed to the user.
28 class ChooserContextBase : public KeyedService {
29 public:
30 ChooserContextBase(Profile* profile,
31 ContentSettingsType permission_type,
32 ContentSettingsType chooser_type);
33 ~ChooserContextBase() override;
34
35 ScopedVector<base::DictionaryValue> GetPreviouslyChosenObjects(
36 const GURL& requesting_origin,
37 const GURL& embedding_origin);
38 void GrantObjectPermission(const GURL& requesting_origin,
39 const GURL& embedding_origin,
40 scoped_ptr<base::DictionaryValue> object);
41 void RevokeObjectPermission(const GURL& requesting_origin,
42 const GURL& embedding_origin,
43 const base::DictionaryValue& object);
44
45 virtual bool IsValidObject(const base::DictionaryValue& object) = 0;
46 virtual std::string GetStringToDisplayForObject(
47 const base::DictionaryValue& object) = 0;
48
49 private:
50 scoped_ptr<base::DictionaryValue> GetWebsiteSetting(
51 const GURL& requesting_origin,
52 const GURL& embedding_origin);
53 void SetWebsiteSetting(const GURL& requesting_origin,
54 const GURL& embedding_origin,
55 scoped_ptr<base::Value> value);
56
57 HostContentSettingsMap* const host_content_settings_map_;
58 const ContentSettingsType permission_type_;
59 const ContentSettingsType chooser_type_;
60 };
61
62 #endif // CHROME_BROWSER_PERMISSIONS_CHOOSER_CONTEXT_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698