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

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

Issue 2184823007: Add a feature which, when enabled, blocks permissions after X prompt dismissals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unify implementation in permission_context_base, make log static Created 4 years, 4 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 <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/containers/scoped_ptr_hash_map.h" 11 #include "base/containers/scoped_ptr_hash_map.h"
12 #include "base/lazy_instance.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/browser/permissions/permission_prompt_decision_log.h"
15 #include "chrome/browser/permissions/permission_request.h" 17 #include "chrome/browser/permissions/permission_request.h"
16 #include "components/content_settings/core/common/content_settings.h" 18 #include "components/content_settings/core/common/content_settings.h"
17 #include "components/content_settings/core/common/content_settings_types.h" 19 #include "components/content_settings/core/common/content_settings_types.h"
18 #include "components/keyed_service/core/keyed_service.h" 20 #include "components/keyed_service/core/keyed_service.h"
19 #include "content/public/browser/permission_type.h" 21 #include "content/public/browser/permission_type.h"
20 #include "url/gurl.h" 22 #include "url/gurl.h"
21 23
22 #if defined(OS_ANDROID) 24 #if defined(OS_ANDROID)
23 class PermissionQueueController; 25 class PermissionQueueController;
24 #endif 26 #endif
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 152
151 // Whether the permission should be restricted to secure origins. 153 // Whether the permission should be restricted to secure origins.
152 virtual bool IsRestrictedToSecureOrigins() const = 0; 154 virtual bool IsRestrictedToSecureOrigins() const = 0;
153 155
154 content::PermissionType permission_type() const { return permission_type_; } 156 content::PermissionType permission_type() const { return permission_type_; }
155 ContentSettingsType content_settings_type() const { 157 ContentSettingsType content_settings_type() const {
156 return content_settings_type_; 158 return content_settings_type_;
157 } 159 }
158 160
159 private: 161 private:
162 friend class PermissionContextBaseTests;
163
160 // Called when a request is no longer used so it can be cleaned up. 164 // Called when a request is no longer used so it can be cleaned up.
161 void CleanUpRequest(const PermissionRequestID& id); 165 void CleanUpRequest(const PermissionRequestID& id);
162 166
167 static base::LazyInstance<PermissionPromptDecisionLog> prompt_decision_log_;
raymes 2016/08/05 03:27:47 It actually seems like the overhead would be negli
dominickn 2016/08/05 04:29:30 Done.
168
163 Profile* profile_; 169 Profile* profile_;
164 const content::PermissionType permission_type_; 170 const content::PermissionType permission_type_;
165 const ContentSettingsType content_settings_type_; 171 const ContentSettingsType content_settings_type_;
166 #if defined(OS_ANDROID) 172 #if defined(OS_ANDROID)
167 std::unique_ptr<PermissionQueueController> permission_queue_controller_; 173 std::unique_ptr<PermissionQueueController> permission_queue_controller_;
168 #endif 174 #endif
169 base::ScopedPtrHashMap<std::string, std::unique_ptr<PermissionRequest>> 175 base::ScopedPtrHashMap<std::string, std::unique_ptr<PermissionRequest>>
170 pending_requests_; 176 pending_requests_;
171 177
172 // Must be the last member, to ensure that it will be 178 // Must be the last member, to ensure that it will be
173 // destroyed first, which will invalidate weak pointers 179 // destroyed first, which will invalidate weak pointers
174 base::WeakPtrFactory<PermissionContextBase> weak_factory_; 180 base::WeakPtrFactory<PermissionContextBase> weak_factory_;
175 }; 181 };
176 182
177 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ 183 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698