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

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, 7 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 const GURL& GetRootUrl() const OVERRIDE { return null_gurl_; }
21
22 private:
23 const GURL null_gurl_;
24 };
25
26 NullFileSystemPeeker kNullObject;
27
28 } // namespace
29
30 FileSystemRegistry::FileSystemRegistry() {
31 }
32
33 FileSystemRegistry::~FileSystemRegistry() {
34 }
35
36 FileSystemRegistry* FileSystemRegistry::GetInstance() {
37 return Singleton<FileSystemRegistry>::get();
38 }
39
40 void FileSystemRegistry::Register(
41 PP_Instance instance,
42 PP_Resource resource,
43 const FileSystemRegistry::FileSystemPeeker* peeker) {
44 mapping_[std::make_pair(instance, resource)] = peeker;
45 }
46
47 void FileSystemRegistry::Unregister(PP_Instance instance,
48 PP_Resource resource) {
palmer 2013/05/02 21:30:09 spaces
victorhsieh 2013/05/03 17:26:58 Done.
49 mapping_.erase(std::make_pair(instance, resource));
50 }
51
52 const FileSystemRegistry::FileSystemPeeker&
53 FileSystemRegistry::LookUp(
54 PP_Instance instance,
55 PP_Resource resource) const {
palmer 2013/05/02 21:30:09 This all fits on one line.
victorhsieh 2013/05/03 17:26:58 Done.
56 ResourceMap::const_iterator iter =
57 mapping_.find(std::make_pair(instance, resource));
58 return (iter != mapping_.end()) ? *(iter->second) : kNullObject;
59 }
60
61 } // namespace host
62 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698