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

Unified Diff: chrome/renderer/extensions/bindings_utils.h

Issue 7767011: Split extension_base.* out of bindings_utils.*. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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
Index: chrome/renderer/extensions/bindings_utils.h
diff --git a/chrome/renderer/extensions/bindings_utils.h b/chrome/renderer/extensions/bindings_utils.h
index c9b2422999de8407c26a0fc9a2c8059d8f5f39b0..c5d69df84920add5bb03a486e357ad5fd8541baa 100644
--- a/chrome/renderer/extensions/bindings_utils.h
+++ b/chrome/renderer/extensions/bindings_utils.h
@@ -8,15 +8,12 @@
#include "base/memory/linked_ptr.h"
#include "base/memory/singleton.h"
-#include "base/string_piece.h"
-#include "ui/base/resource/resource_bundle.h"
#include "v8/include/v8.h"
#include <list>
+#include <map>
#include <string>
-class Extension;
-class ExtensionDispatcher;
class RenderView;
namespace WebKit {
@@ -25,59 +22,6 @@ class WebFrame;
namespace bindings_utils {
-// This is a base class for chrome extension bindings. Common features that
-// are shared by different modules go here.
-class ExtensionBase : public v8::Extension {
- public:
- ExtensionBase(const char* name,
- const char* source,
- int dep_count,
- const char** deps,
- ExtensionDispatcher* extension_dispatcher)
- : v8::Extension(name, source, dep_count, deps),
- extension_dispatcher_(extension_dispatcher) {
- }
-
- // Derived classes should call this at the end of their implementation in
- // order to expose common native functions, like GetChromeHidden, to the
- // v8 extension.
- virtual v8::Handle<v8::FunctionTemplate>
- GetNativeFunction(v8::Handle<v8::String> name);
-
- // TODO(jstritar): Used for testing http://crbug.com/91582. Remove when done.
- ExtensionDispatcher* extension_dispatcher() { return extension_dispatcher_; }
-
- protected:
- template<class T>
- static T* GetFromArguments(const v8::Arguments& args) {
- CHECK(!args.Data().IsEmpty());
- T* result = static_cast<T*>(args.Data().As<v8::External>()->Value());
- return result;
- }
-
- // Note: do not call this function before or during the chromeHidden.onLoad
- // event dispatch. The URL might not have been committed yet and might not
- // be an extension URL.
- const ::Extension* GetExtensionForCurrentContext() const;
-
- // Checks that the current context contains an extension that has permission
- // to execute the specified function. If it does not, a v8 exception is thrown
- // and the method returns false. Otherwise returns true.
- bool CheckPermissionForCurrentContext(const std::string& function_name) const;
-
- // Returns a hidden variable for use by the bindings that is unreachable
- // by the page.
- static v8::Handle<v8::Value> GetChromeHidden(const v8::Arguments& args);
-
- ExtensionDispatcher* extension_dispatcher_;
-
- private:
- // Helper to print from bindings javascript.
- static v8::Handle<v8::Value> Print(const v8::Arguments& args);
-};
-
-const char* GetStringResource(int resource_id);
-
// Contains information about a JavaScript context that is hosting extension
// bindings.
struct ContextInfo {
@@ -113,6 +57,10 @@ ContextList::iterator FindContext(v8::Handle<v8::Context> context);
// Returns the ContextInfo for the current v8 context.
ContextInfo* GetInfoForCurrentContext();
+// Returns the 'chromeHidden' object for the specified context.
+v8::Handle<v8::Object> GetChromeHiddenForContext(
+ v8::Handle<v8::Context> context);
+
// Contains info relevant to a pending API request.
struct PendingRequest {
public :
« no previous file with comments | « chrome/renderer/automation/dom_automation_v8_extension.cc ('k') | chrome/renderer/extensions/bindings_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698