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

Side by Side Diff: chrome/browser/media/chrome_midi_permission_context_factory.cc

Issue 20990005: Web MIDI: implement permission infobar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable icon for now Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 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/media/chrome_midi_permission_context_factory.h"
6
7 #include "chrome/browser/media/chrome_midi_permission_context.h"
8 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
11
12 namespace {
13
14 class Service : public BrowserContextKeyedService {
Bernhard Bauer 2013/07/31 15:35:39 Instead of doing this, you could directly inherit
Takashi Toyoshima 2013/08/01 15:08:13 Done.
15 public:
16 explicit Service(Profile* profile) {
17 context_ = new ChromeMIDIPermissionContext(profile);
18 }
19
20 ChromeMIDIPermissionContext* context() {
21 return context_.get();
22 }
23
24 virtual void Shutdown() OVERRIDE {
25 context()->ShutdownOnUIThread();
26 }
27
28 private:
29 scoped_refptr<ChromeMIDIPermissionContext> context_;
30
31 DISALLOW_COPY_AND_ASSIGN(Service);
32 };
33
34 } // namespace
35
36 // static
37 ChromeMIDIPermissionContext*
38 ChromeMIDIPermissionContextFactory::GetForProfile(Profile* profile) {
39 return static_cast<Service*>(
40 GetInstance()->GetServiceForBrowserContext(profile, true))->context();
41 }
42
43 // static
44 ChromeMIDIPermissionContextFactory*
45 ChromeMIDIPermissionContextFactory::GetInstance() {
46 return Singleton<ChromeMIDIPermissionContextFactory>::get();
47 }
48
49 ChromeMIDIPermissionContextFactory::
50 ChromeMIDIPermissionContextFactory()
51 : BrowserContextKeyedServiceFactory(
52 "ChromeMIDIPermissionContext",
53 BrowserContextDependencyManager::GetInstance()) {
54 }
55
56 ChromeMIDIPermissionContextFactory::
57 ~ChromeMIDIPermissionContextFactory() {
58 }
59
60 BrowserContextKeyedService*
61 ChromeMIDIPermissionContextFactory::BuildServiceInstanceFor(
62 content::BrowserContext* profile) const {
63 return new Service(static_cast<Profile*>(profile));
64 }
65
66 content::BrowserContext*
67 ChromeMIDIPermissionContextFactory::GetBrowserContextToUse(
68 content::BrowserContext* context) const {
69 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698