OLD | NEW |
(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 #ifndef EXTENSIONS_RENDERER_STRING_SOURCE_MAP_H_ |
| 6 #define EXTENSIONS_RENDERER_STRING_SOURCE_MAP_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "extensions/renderer/source_map.h" |
| 13 |
| 14 namespace extensions { |
| 15 |
| 16 // A testing implementation of the source map that takes strings for source |
| 17 // contents. |
| 18 class StringSourceMap : public SourceMap { |
| 19 public: |
| 20 StringSourceMap(); |
| 21 ~StringSourceMap() override; |
| 22 |
| 23 // Adds a new string to be used in the source map. |
| 24 void RegisterModule(const std::string& name, const std::string& source); |
| 25 |
| 26 // SourceMap: |
| 27 v8::Local<v8::String> GetSource(v8::Isolate* isolate, |
| 28 const std::string& name) const override; |
| 29 bool Contains(const std::string& name) const override; |
| 30 |
| 31 private: |
| 32 std::map<std::string, std::string> sources_; |
| 33 |
| 34 DISALLOW_COPY_AND_ASSIGN(StringSourceMap); |
| 35 }; |
| 36 |
| 37 } // namespace extensions |
| 38 |
| 39 #endif // EXTENSIONS_RENDERER_STRING_SOURCE_MAP_H_ |
OLD | NEW |