[email protected] | e689367 | 2014-05-01 17:29:13 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
[email protected] | ecde191 | 2012-03-16 06:25:31 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | e689367 | 2014-05-01 17:29:13 | [diff] [blame] | 5 | #ifndef EXTENSIONS_RENDERER_RESOURCE_BUNDLE_SOURCE_MAP_H_ |
6 | #define EXTENSIONS_RENDERER_RESOURCE_BUNDLE_SOURCE_MAP_H_ | ||||
[email protected] | ecde191 | 2012-03-16 06:25:31 | [diff] [blame] | 7 | |
8 | #include <map> | ||||
9 | #include <string> | ||||
10 | |||||
[email protected] | e689367 | 2014-05-01 17:29:13 | [diff] [blame] | 11 | #include "base/compiler_specific.h" |
[email protected] | e689367 | 2014-05-01 17:29:13 | [diff] [blame] | 12 | #include "extensions/renderer/module_system.h" |
[email protected] | e689367 | 2014-05-01 17:29:13 | [diff] [blame] | 13 | #include "v8/include/v8.h" |
14 | |||||
[email protected] | ecde191 | 2012-03-16 06:25:31 | [diff] [blame] | 15 | namespace ui { |
[email protected] | e689367 | 2014-05-01 17:29:13 | [diff] [blame] | 16 | class ResourceBundle; |
[email protected] | ecde191 | 2012-03-16 06:25:31 | [diff] [blame] | 17 | } |
18 | |||||
[email protected] | e689367 | 2014-05-01 17:29:13 | [diff] [blame] | 19 | namespace extensions { |
20 | |||||
[email protected] | 3c6babd | 2012-08-28 03:17:29 | [diff] [blame] | 21 | class ResourceBundleSourceMap : public extensions::ModuleSystem::SourceMap { |
[email protected] | ecde191 | 2012-03-16 06:25:31 | [diff] [blame] | 22 | public: |
23 | explicit ResourceBundleSourceMap(const ui::ResourceBundle* resource_bundle); | ||||
dcheng | 9168b2f | 2014-10-21 12:38:24 | [diff] [blame] | 24 | ~ResourceBundleSourceMap() override; |
[email protected] | ecde191 | 2012-03-16 06:25:31 | [diff] [blame] | 25 | |
tfarina | f85316f | 2015-04-29 17:03:40 | [diff] [blame] | 26 | v8::Local<v8::Value> GetSource(v8::Isolate* isolate, |
lazyboy | ce33396 | 2016-04-12 18:22:04 | [diff] [blame] | 27 | const std::string& name) const override; |
28 | bool Contains(const std::string& name) const override; | ||||
[email protected] | ecde191 | 2012-03-16 06:25:31 | [diff] [blame] | 29 | |
30 | void RegisterSource(const std::string& name, int resource_id); | ||||
31 | |||||
32 | private: | ||||
[email protected] | ecde191 | 2012-03-16 06:25:31 | [diff] [blame] | 33 | const ui::ResourceBundle* resource_bundle_; |
34 | std::map<std::string, int> resource_id_map_; | ||||
lazyboy | ce33396 | 2016-04-12 18:22:04 | [diff] [blame] | 35 | |
36 | DISALLOW_COPY_AND_ASSIGN(ResourceBundleSourceMap); | ||||
[email protected] | ecde191 | 2012-03-16 06:25:31 | [diff] [blame] | 37 | }; |
38 | |||||
[email protected] | e689367 | 2014-05-01 17:29:13 | [diff] [blame] | 39 | } // namespace extensions |
40 | |||||
41 | #endif // EXTENSIONS_RENDERER_RESOURCE_BUNDLE_SOURCE_MAP_H_ |