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

Side by Side Diff: ppapi/host/file_system_registry.cc

Issue 14188019: CRX FileSystem Pepper private API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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 (c) 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 "ppapi/host/file_system_registry.h"
6
7 #include "googleurl/src/gurl.h"
8
9 namespace ppapi {
10 namespace host {
11
12 namespace {
13
14 class NullFileSystemPeeker : public FileSystemRegistry::FileSystemPeeker {
15 public:
16 virtual PP_FileSystemType GetType() const OVERRIDE {
17 return PP_FILESYSTEMTYPE_INVALID;
18 }
19 virtual bool IsOpened() const OVERRIDE { return false; }
20 virtual GURL GetRootUrl() const OVERRIDE { return GURL(); }
21 };
22
23 NullFileSystemPeeker kNullObject;
24
25 } // namespace
26
27 FileSystemRegistry::FileSystemRegistry() {
28 }
29
30 FileSystemRegistry::~FileSystemRegistry() {
31 }
32
33 FileSystemRegistry* FileSystemRegistry::GetInstance() {
34 return Singleton<FileSystemRegistry>::get();
35 }
36
37 void FileSystemRegistry::Register(
38 PP_Instance instance,
39 PP_Resource resource,
40 const FileSystemRegistry::FileSystemPeeker* peeker) {
41 mapping_[std::make_pair(instance, resource)] = peeker;
42 }
43
44 void FileSystemRegistry::Unregister(PP_Instance instance,
45 PP_Resource resource) {
46 mapping_.erase(std::make_pair(instance, resource));
47 }
48
49 const FileSystemRegistry::FileSystemPeeker&
50 FileSystemRegistry::LookUp(
51 PP_Instance instance,
52 PP_Resource resource) const {
53 ResourceMap::const_iterator iter =
54 mapping_.find(std::make_pair(instance, resource));
55 return (iter != mapping_.end()) ? *(iter->second) : kNullObject;
56 }
57
58 } // namespace host
59 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698