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

Side by Side Diff: chrome/browser/usb/usb_chooser_context_factory.cc

Issue 1382783002: Store USB device permissions in website settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address mlamouri@'s comments. Created 5 years, 1 month 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/usb/usb_chooser_context_factory.h"
6
7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
8 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/usb/usb_chooser_context.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12
13 UsbChooserContextFactory::UsbChooserContextFactory()
14 : BrowserContextKeyedServiceFactory(
15 "UsbChooserContext",
16 BrowserContextDependencyManager::GetInstance()) {
17 DependsOn(HostContentSettingsMapFactory::GetInstance());
18 }
19
20 UsbChooserContextFactory::~UsbChooserContextFactory() {}
21
22 KeyedService* UsbChooserContextFactory::BuildServiceInstanceFor(
23 content::BrowserContext* context) const {
24 return new UsbChooserContext(Profile::FromBrowserContext(context));
25 }
26
27 // static
28 UsbChooserContextFactory* UsbChooserContextFactory::GetInstance() {
29 return base::Singleton<UsbChooserContextFactory>::get();
30 }
31
32 // static
33 UsbChooserContext* UsbChooserContextFactory::GetForProfile(Profile* profile) {
34 return static_cast<UsbChooserContext*>(
35 GetInstance()->GetServiceForBrowserContext(profile, true));
36 }
37
38 content::BrowserContext* UsbChooserContextFactory::GetBrowserContextToUse(
39 content::BrowserContext* context) const {
40 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
41 }
OLDNEW
« no previous file with comments | « chrome/browser/usb/usb_chooser_context_factory.h ('k') | chrome/browser/usb/usb_chooser_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698