Index: chrome/browser/permissions/chooser_permission_context_base.h |
diff --git a/chrome/browser/permissions/chooser_permission_context_base.h b/chrome/browser/permissions/chooser_permission_context_base.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..921bc478daed1772217acdf97b4db0fd881c1ee9 |
--- /dev/null |
+++ b/chrome/browser/permissions/chooser_permission_context_base.h |
@@ -0,0 +1,60 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_PERMISSIONS_CHOOSER_PERMISSION_CONTEXT_BASE_H_ |
+#define CHROME_BROWSER_PERMISSIONS_CHOOSER_PERMISSION_CONTEXT_BASE_H_ |
+ |
+#include <string> |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/scoped_vector.h" |
+#include "components/content_settings/core/common/content_settings_types.h" |
+#include "components/keyed_service/core/keyed_service.h" |
+ |
+namespace base { |
+class DictionaryValue; |
+class ListValue; |
raymes
2015/10/14 02:07:04
nit: unused
Reilly Grant (use Gerrit)
2015/10/22 00:57:02
Done.
|
+class Value; |
+} |
+ |
+class GURL; |
+class HostContentSettingsMap; |
+class Profile; |
+ |
+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.
|
+ 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.
|
+ 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.
|
+ |
+ ChooserPermissionContextBase(Profile* profile, |
+ ContentSettingsType permission_type, |
+ ContentSettingsType chooser_settings_type); |
+ ~ChooserPermissionContextBase() override; |
+ |
+ ObjectList GetPreviouslyChosenObjects(const GURL& requesting_origin, |
+ const GURL& embedding_origin); |
+ void GrantObjectPermission(const GURL& requesting_origin, |
+ const GURL& embedding_origin, |
+ scoped_ptr<base::DictionaryValue> object); |
+ void RevokeObjectPermission(const GURL& requesting_origin, |
+ const GURL& embedding_origin, |
+ const base::DictionaryValue& object); |
+ |
+ virtual bool IsValidObject(const base::DictionaryValue& object) = 0; |
+ 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.
|
+ const base::DictionaryValue& object) = 0; |
+ |
+ private: |
+ scoped_ptr<base::DictionaryValue> GetWebsiteSetting( |
+ const GURL& requesting_origin, |
+ const GURL& embedding_origin); |
+ void SetWebsiteSetting(const GURL& requesting_origin, |
+ const GURL& embedding_origin, |
+ scoped_ptr<base::Value> value); |
+ |
+ HostContentSettingsMap* const host_content_settings_map_; |
+ const ContentSettingsType permission_type_; |
+ const ContentSettingsType chooser_settings_type_; |
+}; |
+ |
+#endif // CHROME_BROWSER_PERMISSIONS_CHOOSER_PERMISSION_CONTEXT_BASE_H_ |