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

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

Issue 2575173002: [Extensions Bindings] Add a bridge to use current custom bindings (Closed)
Patch Set: . 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)) << "Module " << name << " not found";
jbroman 2016/12/16 19:00:50 Isn't the opposite the problem, that the module _w
Devlin 2016/12/16 20:31:17 Copy-paste code strikes again! It was this way in
30 sources_[name] = source;
31 }
32
33 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698