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.
5 #ifndef CHROME_RENDERER_RESOURCE_BUNDLE_SOURCE_MAP_H_
6 #define CHROME_RENDERER_RESOURCE_BUNDLE_SOURCE_MAP_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/linked_ptr.h"
10 #include "base/strings/string_piece.h"
11 #include "chrome/renderer/extensions/module_system.h"
12 #include "chrome/renderer/static_v8_external_string_resource.h"
13 #include "v8/include/v8.h"
22 class ResourceBundleSourceMap : public extensions::ModuleSystem::SourceMap {
24 explicit ResourceBundleSourceMap(const ui::ResourceBundle* resource_bundle);
25 virtual ~ResourceBundleSourceMap();
27 virtual v8::Handle<v8::Value> GetSource(v8::Isolate* isolate,
28 const std::string& name) OVERRIDE;
29 virtual bool Contains(const std::string& name) OVERRIDE;
31 void RegisterSource(const std::string& name, int resource_id);
34 v8::Handle<v8::String> ConvertString(v8::Isolate* isolate,
35 const base::StringPiece& string);
37 const ui::ResourceBundle* resource_bundle_;
38 std::map<std::string, int> resource_id_map_;
41 #endif // CHROME_RENDERER_RESOURCE_BUNDLE_SOURCE_MAP_H_