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

Side by Side Diff: chrome/renderer/extensions/bindings_utils.h

Issue 155309: Chrome-side of fixes for content-script messaging. (Closed)
Patch Set: temporary webkit hack Created 11 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/renderer/extensions/event_bindings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_
6 #define CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ 6 #define CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_
7 7
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/linked_ptr.h" 9 #include "base/linked_ptr.h"
10 #include "base/singleton.h" 10 #include "base/singleton.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 const char* GetStringResource() { 54 const char* GetStringResource() {
55 return 55 return
56 Singleton< StringResourceTemplate<kResourceId> >::get()->resource.c_str(); 56 Singleton< StringResourceTemplate<kResourceId> >::get()->resource.c_str();
57 } 57 }
58 58
59 // Contains information about a single javascript context. 59 // Contains information about a single javascript context.
60 struct ContextInfo { 60 struct ContextInfo {
61 v8::Persistent<v8::Context> context; 61 v8::Persistent<v8::Context> context;
62 std::string extension_id; // empty if the context is not an extension 62 std::string extension_id; // empty if the context is not an extension
63 63
64 // If this context is a content script, parent will be the frame that it
65 // was injected in. This is empty if the context is not a content script.
66 v8::Persistent<v8::Context> parent_context;
67
64 ContextInfo(v8::Persistent<v8::Context> context, 68 ContextInfo(v8::Persistent<v8::Context> context,
65 const std::string& extension_id) 69 const std::string& extension_id,
66 : context(context), extension_id(extension_id) {} 70 v8::Persistent<v8::Context> parent_context)
71 : context(context), extension_id(extension_id),
72 parent_context(parent_context) {}
67 }; 73 };
68 typedef std::list< linked_ptr<ContextInfo> > ContextList; 74 typedef std::list< linked_ptr<ContextInfo> > ContextList;
69 75
70 // Returns a mutable reference to the ContextList. 76 // Returns a mutable reference to the ContextList.
71 ContextList& GetContexts(); 77 ContextList& GetContexts();
72 78
73 // Returns a (copied) list of contexts that have the given extension_id. 79 // Returns a (copied) list of contexts that have the given extension_id.
74 ContextList GetContextsForExtension(const std::string& extension_id); 80 ContextList GetContextsForExtension(const std::string& extension_id);
75 81
76 // Returns the ContextInfo item that has the given context. 82 // Returns the ContextInfo item that has the given context.
(...skipping 20 matching lines...) Expand all
97 // Call the named javascript function with the given arguments in a context. 103 // Call the named javascript function with the given arguments in a context.
98 // The function name should be reachable from the chromeHidden object, and can 104 // The function name should be reachable from the chromeHidden object, and can
99 // be a sub-property like "Port.dispatchOnMessage". 105 // be a sub-property like "Port.dispatchOnMessage".
100 void CallFunctionInContext(v8::Handle<v8::Context> context, 106 void CallFunctionInContext(v8::Handle<v8::Context> context,
101 const std::string& function_name, int argc, 107 const std::string& function_name, int argc,
102 v8::Handle<v8::Value>* argv); 108 v8::Handle<v8::Value>* argv);
103 109
104 } // namespace bindings_utils 110 } // namespace bindings_utils
105 111
106 #endif // CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ 112 #endif // CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/extensions/event_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698