| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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 CHROME_RENDERER_RESOURCE_BUNDLE_SOURCE_MAP_H_ | |
| 6 #define CHROME_RENDERER_RESOURCE_BUNDLE_SOURCE_MAP_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/linked_ptr.h" | |
| 11 #include "base/string_piece.h" | |
| 12 #include "chrome/renderer/module_system.h" | |
| 13 #include "chrome/renderer/static_v8_external_string_resource.h" | |
| 14 #include "v8/include/v8.h" | |
| 15 | |
| 16 #include <map> | |
| 17 #include <string> | |
| 18 | |
| 19 namespace ui { | |
| 20 class ResourceBundle; | |
| 21 } | |
| 22 | |
| 23 class ResourceBundleSourceMap : public ModuleSystem::SourceMap { | |
| 24 public: | |
| 25 explicit ResourceBundleSourceMap(const ui::ResourceBundle* resource_bundle); | |
| 26 ~ResourceBundleSourceMap(); | |
| 27 | |
| 28 virtual v8::Handle<v8::Value> GetSource(const std::string& name) OVERRIDE; | |
| 29 virtual bool Contains(const std::string& name) OVERRIDE; | |
| 30 | |
| 31 void RegisterSource(const std::string& name, int resource_id); | |
| 32 | |
| 33 private: | |
| 34 v8::Handle<v8::String> ConvertString(const base::StringPiece& string); | |
| 35 | |
| 36 const ui::ResourceBundle* resource_bundle_; | |
| 37 std::map<std::string, int> resource_id_map_; | |
| 38 }; | |
| 39 | |
| 40 #endif // CHROME_RENDERER_RESOURCE_BUNDLE_SOURCE_MAP_H_ | |
| OLD | NEW |