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

Side by Side Diff: chrome/browser/permissions/chooser_permission_context.cc

Issue 1382783002: Store USB device permissions in website settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove UsbPermissionContext and add ChooserPermissionContext helper functions. 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 #include "chrome/browser/permissions/chooser_permission_context.h"
6
7 #include "chrome/browser/usb/usb_chooser_permission_context.h"
8 #include "chrome/browser/usb/usb_chooser_permission_context_factory.h"
9 #include "content/public/browser/permission_type.h"
10
11 using content::PermissionType;
12
13 // static
14 ChooserPermissionContextBase* ChooserPermissionContext::Get(
15 Profile* profile,
16 PermissionType permission_type) {
17 // NOTE: the factories used in this method have to stay in sync with
18 // ::GetFactories() below.
19 switch (permission_type) {
20 case PermissionType::USB:
21 return UsbChooserPermissionContextFactory::GetForProfile(profile);
22 default:
23 NOTREACHED() << "No ChooserPermissionContext associated with "
24 << static_cast<int>(permission_type);
25 break;
26 }
27
28 return nullptr;
29 }
30
31 // static
32 const std::list<KeyedServiceBaseFactory*>&
33 ChooserPermissionContext::GetFactories() {
34 // NOTE: this list has to stay in sync with the factories used by ::Get().
35 CR_DEFINE_STATIC_LOCAL(std::list<KeyedServiceBaseFactory*>, factories, ());
36
37 if (factories.empty()) {
38 factories.push_back(UsbChooserPermissionContextFactory::GetInstance());
39 }
40
41 return factories;
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698