summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/extension_messages_unittest.cc6
-rwxr-xr-xchrome/browser/resources/extensions_toolstrip.css5
-rw-r--r--chrome/renderer/extensions/extension_process_bindings.cc4
-rwxr-xr-xchrome/renderer/extensions/renderer_extension_bindings.cc6
-rwxr-xr-xchrome/renderer/extensions/renderer_extension_bindings.h4
-rwxr-xr-xchrome/renderer/renderer_resources.grd4
-rw-r--r--chrome/renderer/resources/extension_process_bindings.js8
-rw-r--r--chrome/renderer/resources/renderer_extension_bindings.js8
-rw-r--r--chrome/renderer/user_script_slave.cc6
9 files changed, 35 insertions, 16 deletions
diff --git a/chrome/browser/extensions/extension_messages_unittest.cc b/chrome/browser/extensions/extension_messages_unittest.cc
index 565f664..009d574 100644
--- a/chrome/browser/extensions/extension_messages_unittest.cc
+++ b/chrome/browser/extensions/extension_messages_unittest.cc
@@ -15,7 +15,7 @@ TEST_F(RenderViewTest, ExtensionMessagesOpenChannel) {
ExecuteJavaScript(
"var e = new chromium.Extension('foobar');"
"var port = e.connect();"
- "port.onmessage.addListener(doOnMessage);"
+ "port.onMessage.addListener(doOnMessage);"
"port.postMessage({message: 'content ready'});"
"function doOnMessage(msg, port) {"
" alert('content got: ' + msg.val);"
@@ -56,8 +56,8 @@ TEST_F(RenderViewTest, ExtensionMessagesOpenChannel) {
TEST_F(RenderViewTest, ExtensionMessagesOnConnect) {
LoadHTML("<body></body>");
ExecuteJavaScript(
- "chromium.onconnect.addListener(function (port) {"
- " port.onmessage.addListener(doOnMessage);"
+ "chromium.self.onConnect.addListener(function (port) {"
+ " port.onMessage.addListener(doOnMessage);"
" port.postMessage({message: 'onconnect'});"
"});"
"function doOnMessage(msg, port) {"
diff --git a/chrome/browser/resources/extensions_toolstrip.css b/chrome/browser/resources/extensions_toolstrip.css
index a8a332d..921f97f 100755
--- a/chrome/browser/resources/extensions_toolstrip.css
+++ b/chrome/browser/resources/extensions_toolstrip.css
@@ -10,6 +10,7 @@ body {
#main {
background: -webkit-gradient(linear, left top, left bottom, from(rgb(222, 234, 248)), to(rgb(237, 244, 252)));
padding-top: 3px;
- height:19px;
- overflow:hidden;
+ height: 21px;
+ overflow: hidden;
+ white-space: nowrap;
}
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc
index 0e47b23..3f53898 100644
--- a/chrome/renderer/extensions/extension_process_bindings.cc
+++ b/chrome/renderer/extensions/extension_process_bindings.cc
@@ -6,6 +6,7 @@
#include "chrome/common/render_messages.h"
#include "chrome/renderer/extensions/bindings_utils.h"
+#include "chrome/renderer/extensions/renderer_extension_bindings.h"
#include "chrome/renderer/js_only_v8_extensions.h"
#include "chrome/renderer/render_view.h"
#include "grit/renderer_resources.h"
@@ -21,7 +22,8 @@ const char kExtensionName[] = "chrome/ExtensionProcessBindings";
const char* kExtensionDeps[] = {
BaseJsV8Extension::kName,
JsonJsV8Extension::kName,
- JsonSchemaJsV8Extension::kName
+ JsonSchemaJsV8Extension::kName,
+ RendererExtensionBindings::kName,
};
class ExtensionImpl : public v8::Extension {
diff --git a/chrome/renderer/extensions/renderer_extension_bindings.cc b/chrome/renderer/extensions/renderer_extension_bindings.cc
index d9a73e6..8035422 100755
--- a/chrome/renderer/extensions/renderer_extension_bindings.cc
+++ b/chrome/renderer/extensions/renderer_extension_bindings.cc
@@ -27,13 +27,12 @@ namespace {
// We use the generic interface so that unit tests can inject a mock.
RenderThreadBase* render_thread_ = NULL;
-const char* kExtensionName = "chrome/RendererExtensionBindings";
const char* kExtensionDeps[] = { EventBindings::kName };
class ExtensionImpl : public v8::Extension {
public:
ExtensionImpl()
- : v8::Extension(kExtensionName,
+ : v8::Extension(RendererExtensionBindings::kName,
GetStringResource<IDR_RENDERER_EXTENSION_BINDINGS_JS>(),
arraysize(kExtensionDeps), kExtensionDeps) {
}
@@ -76,6 +75,9 @@ class ExtensionImpl : public v8::Extension {
} // namespace
+const char* RendererExtensionBindings::kName =
+ "chrome/RendererExtensionBindings";
+
v8::Extension* RendererExtensionBindings::Get(RenderThreadBase* render_thread) {
render_thread_ = render_thread;
return new ExtensionImpl();
diff --git a/chrome/renderer/extensions/renderer_extension_bindings.h b/chrome/renderer/extensions/renderer_extension_bindings.h
index 5ff474e..3fc1fb4 100755
--- a/chrome/renderer/extensions/renderer_extension_bindings.h
+++ b/chrome/renderer/extensions/renderer_extension_bindings.h
@@ -15,6 +15,10 @@ class RenderThreadBase;
// used by both web renderers and extension processes.
class RendererExtensionBindings {
public:
+ // Name of extension, for dependencies.
+ static const char* kName;
+
+ // Creates an instance of the extension.
static v8::Extension* Get(RenderThreadBase* render_thread);
// Notify any listeners that a message channel has been opened to this
diff --git a/chrome/renderer/renderer_resources.grd b/chrome/renderer/renderer_resources.grd
index e7084d5..cda253b 100755
--- a/chrome/renderer/renderer_resources.grd
+++ b/chrome/renderer/renderer_resources.grd
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- This comment is only here because changes to resources are not picked up
+without changes to the corresponding grd file. -->
<grit latest_public_release="0" current_release="1">
<outputs>
<output filename="grit/renderer_resources.h" type="rc_header">
@@ -19,4 +21,4 @@
<include name="IDR_RENDERER_EXTENSION_BINDINGS_JS" file="resources\renderer_extension_bindings.js" type="BINDATA" />
</includes>
</release>
-</grit> \ No newline at end of file
+</grit>
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js
index ff7ac7e..454a9b0 100644
--- a/chrome/renderer/resources/extension_process_bindings.js
+++ b/chrome/renderer/resources/extension_process_bindings.js
@@ -66,6 +66,8 @@ var chromium;
request(sargs, callbackId);
}
+ //----------------------------------------------------------------------------
+
// Tabs
chromium.tabs = {};
// TODO(aa): This should eventually take an optional windowId param.
@@ -127,4 +129,10 @@ var chromium;
chromium.tabs.removeTab.params = [
chromium.types.pInt
];
+
+ //----------------------------------------------------------------------------
+
+ // Self
+ chromium.self = {};
+ chromium.self.onConnect = new chromium.Event("channel-connect");
})();
diff --git a/chrome/renderer/resources/renderer_extension_bindings.js b/chrome/renderer/resources/renderer_extension_bindings.js
index a392cf0..fafd491 100644
--- a/chrome/renderer/resources/renderer_extension_bindings.js
+++ b/chrome/renderer/resources/renderer_extension_bindings.js
@@ -10,10 +10,10 @@ var chromium = chromium || {};
throw new Error("Port '" + portId + "' already exists.");
}
this.portId_ = portId; // TODO(mpcomplete): readonly
- this.onmessage = new chromium.Event();
+ this.onMessage = new chromium.Event();
chromium.Port.ports_[portId] = this;
// Note: this object will never get GCed. If we ever care, we could
- // add an "ondetach" method to the onmessage Event that gets called
+ // add an "ondetach" method to the onMessage Event that gets called
// when there are no more listeners.
};
@@ -33,7 +33,7 @@ var chromium = chromium || {};
if (msg) {
msg = goog.json.parse(msg);
}
- port.onmessage.dispatch(msg, port);
+ port.onMessage.dispatch(msg, port);
}
};
@@ -62,6 +62,4 @@ var chromium = chromium || {};
chromium.Extension.prototype.getURL = function(path) {
return "chrome-extension://" + this.id_ + "/" + path;
};
-
- chromium.onconnect = new chromium.Event("channel-connect");
})();
diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc
index bd5a988..651e9ad 100644
--- a/chrome/renderer/user_script_slave.cc
+++ b/chrome/renderer/user_script_slave.cc
@@ -25,7 +25,9 @@ using WebKit::WebString;
static const char kUserScriptHead[] = "(function (unsafeWindow) {\n";
static const char kUserScriptTail[] = "\n})(window);";
-static const char kInitSelf[] = "chromium.self = new chromium.Extension('%s')";
+// Creates a convenient reference to a content script's parent extension.
+static const char kInitExtension[] =
+ "chromium.extension = new chromium.Extension('%s')";
UserScriptSlave::UserScriptSlave()
: shared_memory_(NULL),
@@ -153,7 +155,7 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame,
// ID.
sources.insert(sources.begin(),
WebScriptSource(WebString::fromUTF8(
- StringPrintf(kInitSelf, script->extension_id().c_str()))));
+ StringPrintf(kInitExtension, script->extension_id().c_str()))));
}
frame->ExecuteScriptInNewContext(&sources.front(), sources.size());