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

Unified Diff: chrome/renderer/resource_bundle_source_map.h

Issue 9386001: Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/renderer_resources.grd ('k') | chrome/renderer/resource_bundle_source_map.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resource_bundle_source_map.h
diff --git a/chrome/renderer/resource_bundle_source_map.h b/chrome/renderer/resource_bundle_source_map.h
new file mode 100644
index 0000000000000000000000000000000000000000..142930c48a909c248294f5cbdb348dec6d3e7526
--- /dev/null
+++ b/chrome/renderer/resource_bundle_source_map.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_RENDERER_RESOURCE_BUNDLE_SOURCE_MAP_H_
+#define CHROME_RENDERER_RESOURCE_BUNDLE_SOURCE_MAP_H_
+#pragma once
+
+#include "base/compiler_specific.h"
+#include "base/memory/linked_ptr.h"
+#include "base/string_piece.h"
+#include "chrome/renderer/module_system.h"
+#include "chrome/renderer/static_v8_external_string_resource.h"
+#include "v8/include/v8.h"
+
+#include <map>
+#include <string>
+
+namespace ui {
+ class ResourceBundle;
+}
+
+class ResourceBundleSourceMap : public ModuleSystem::SourceMap {
+ public:
+ explicit ResourceBundleSourceMap(const ui::ResourceBundle* resource_bundle);
+ ~ResourceBundleSourceMap();
+
+ virtual v8::Handle<v8::Value> GetSource(const std::string& name) OVERRIDE;
+ virtual bool Contains(const std::string& name) OVERRIDE;
+
+ void RegisterSource(const std::string& name, int resource_id);
+
+ private:
+ v8::Handle<v8::String> ConvertString(const base::StringPiece& string);
+
+ const ui::ResourceBundle* resource_bundle_;
+ std::map<std::string, int> resource_id_map_;
+};
+
+#endif // CHROME_RENDERER_RESOURCE_BUNDLE_SOURCE_MAP_H_
« no previous file with comments | « chrome/renderer/renderer_resources.grd ('k') | chrome/renderer/resource_bundle_source_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698