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

Side by Side Diff: chrome/browser/permissions/permission_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: Convert WebUSBPermissionStore to a PermissionContext. 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_PERMISSION_CONTEXT_BASE_H_ 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/containers/scoped_ptr_hash_map.h" 9 #include "base/containers/scoped_ptr_hash_map.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 bool allowed) {} 114 bool allowed) {}
115 115
116 #if defined(OS_ANDROID) 116 #if defined(OS_ANDROID)
117 // Return an instance of the infobar queue controller, creating it if needed. 117 // Return an instance of the infobar queue controller, creating it if needed.
118 PermissionQueueController* GetQueueController(); 118 PermissionQueueController* GetQueueController();
119 #endif 119 #endif
120 120
121 // Returns the profile associated with this permission context. 121 // Returns the profile associated with this permission context.
122 Profile* profile() const; 122 Profile* profile() const;
123 123
124 // Returns the permission type managed by this context.
125 ContentSettingsType type() const;
mlamouri (slow - plz ping) 2015/10/06 11:03:17 We want stuff in permissions/ to abstract ContentS
Reilly Grant (use Gerrit) 2015/10/06 20:45:30 That's why I made it a protected method. Otherwise
126
124 // Store the decided permission as a content setting. 127 // Store the decided permission as a content setting.
125 // virtual since the permission might be stored with different restrictions 128 // virtual since the permission might be stored with different restrictions
126 // (for example for desktop notifications). 129 // (for example for desktop notifications).
127 virtual void UpdateContentSetting(const GURL& requesting_origin, 130 virtual void UpdateContentSetting(const GURL& requesting_origin,
128 const GURL& embedding_origin, 131 const GURL& embedding_origin,
129 ContentSetting content_setting); 132 ContentSetting content_setting);
130 133
131 // Whether the permission should be restricted to secure origins. 134 // Whether the permission should be restricted to secure origins.
132 virtual bool IsRestrictedToSecureOrigins() const = 0; 135 virtual bool IsRestrictedToSecureOrigins() const = 0;
133 136
134 private: 137 private:
135 // Called when a bubble is no longer used so it can be cleaned up. 138 // Called when a bubble is no longer used so it can be cleaned up.
136 void CleanUpBubble(const PermissionRequestID& id); 139 void CleanUpBubble(const PermissionRequestID& id);
137 140
138 Profile* profile_; 141 Profile* profile_;
139 const ContentSettingsType permission_type_; 142 const ContentSettingsType permission_type_;
140 #if defined(OS_ANDROID) 143 #if defined(OS_ANDROID)
141 scoped_ptr<PermissionQueueController> permission_queue_controller_; 144 scoped_ptr<PermissionQueueController> permission_queue_controller_;
142 #endif 145 #endif
143 base::ScopedPtrHashMap<std::string, scoped_ptr<PermissionBubbleRequest>> 146 base::ScopedPtrHashMap<std::string, scoped_ptr<PermissionBubbleRequest>>
144 pending_bubbles_; 147 pending_bubbles_;
145 148
146 // Must be the last member, to ensure that it will be 149 // Must be the last member, to ensure that it will be
147 // destroyed first, which will invalidate weak pointers 150 // destroyed first, which will invalidate weak pointers
148 base::WeakPtrFactory<PermissionContextBase> weak_factory_; 151 base::WeakPtrFactory<PermissionContextBase> weak_factory_;
149 }; 152 };
150 153
151 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ 154 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698