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

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

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 #include "chrome/browser/permissions/chooser_context.h"
6
7 #include "base/logging.h"
8 #include "chrome/browser/permissions/chooser_type.h"
9
10 #if !defined(OS_ANDROID)
11 #include "chrome/browser/usb/usb_chooser_context.h"
12 #include "chrome/browser/usb/usb_chooser_context_factory.h"
13 #endif
14
15 // static
16 ChooserContextBase* ChooserContext::Get(Profile* profile,
17 ChooserType chooser_type) {
18 // NOTE: the factories used in this method have to stay in sync with
19 // ::GetFactories() below.
20 switch (chooser_type) {
21 #if !defined(OS_ANDROID)
22 case ChooserType::USB:
23 return UsbChooserContextFactory::GetForProfile(profile);
24 #endif
25 default:
26 NOTREACHED() << "No ChooserContext associated with "
27 << static_cast<int>(chooser_type);
28 break;
29 }
30
31 return nullptr;
32 }
33
34 // static
35 const std::list<KeyedServiceBaseFactory*>& ChooserContext::GetFactories() {
36 // NOTE: this list has to stay in sync with the factories used by ::Get().
37 CR_DEFINE_STATIC_LOCAL(std::list<KeyedServiceBaseFactory*>, factories, ());
38
39 if (factories.empty()) {
40 #if !defined(OS_ANDROID)
41 factories.push_back(UsbChooserContextFactory::GetInstance());
42 #endif
43 }
44
45 return factories;
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698