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

Side by Side Diff: extensions/renderer/string_source_map.cc

Issue 2586303002: [Extensions Bindings] Pull out test resources (Closed)
Patch Set: comment Created 4 years 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 2016 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 "extensions/renderer/string_source_map.h"
6
7 #include "gin/converter.h"
8
9 namespace extensions {
10
11 StringSourceMap::StringSourceMap() {}
12 StringSourceMap::~StringSourceMap() {}
13
14 v8::Local<v8::String> StringSourceMap::GetSource(
15 v8::Isolate* isolate,
16 const std::string& name) const {
17 const auto& iter = sources_.find(name);
18 if (iter == sources_.end())
19 return v8::Local<v8::String>();
20 return gin::StringToV8(isolate, iter->second);
21 }
22
23 bool StringSourceMap::Contains(const std::string& name) const {
24 return sources_.find(name) != sources_.end();
25 }
26
27 void StringSourceMap::RegisterModule(const std::string& name,
28 const std::string& source) {
29 CHECK_EQ(0u, sources_.count(name)) << "A module for '" << name
30 << "' already exists.";
31 sources_[name] = source;
32 }
33
34 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/string_source_map.h ('k') | extensions/renderer/test_v8_extension_configuration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698