summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions
diff options
context:
space:
mode:
authormbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-18 22:51:17 +0000
committermbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-18 22:51:17 +0000
commitc130a214c64fd76d53783523a7c63a78848e4474 (patch)
treef018ecf50605be1376177655669e3f8c3afbaa42 /chrome/renderer/extensions
parent07442307cd72bbe129cb87887438e82f146c0773 (diff)
downloadchromium_src-c130a214c64fd76d53783523a7c63a78848e4474.zip
chromium_src-c130a214c64fd76d53783523a7c63a78848e4474.tar.gz
chromium_src-c130a214c64fd76d53783523a7c63a78848e4474.tar.bz2
Revert 26635 - Change the view mode when switching between moles and toolstrips, and
propogate this into the class of the document element so that it's possible to use CSS rules to control the display of your toolstrip/mole. BUG=21939,15494 TEST=run the Mappy extension and verify it can open and close Review URL: http://codereview.chromium.org/208020 TBR=erikkay@chromium.org Review URL: http://codereview.chromium.org/210024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26636 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/extensions')
-rw-r--r--chrome/renderer/extensions/extension_process_bindings.cc46
-rw-r--r--chrome/renderer/extensions/extension_process_bindings.h9
2 files changed, 2 insertions, 53 deletions
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc
index 0fc9438..7a9d0ac 100644
--- a/chrome/renderer/extensions/extension_process_bindings.cc
+++ b/chrome/renderer/extensions/extension_process_bindings.cc
@@ -28,7 +28,6 @@ using bindings_utils::GetPendingRequestMap;
using bindings_utils::PendingRequest;
using bindings_utils::PendingRequestMap;
using bindings_utils::ExtensionBase;
-using WebKit::WebFrame;
namespace {
@@ -120,25 +119,6 @@ class ExtensionImpl : public ExtensionBase {
return v8::String::New(GetStringResource<IDR_EXTENSION_API_JSON>());
}
- // Returns true is |type| "isa" |match|.
- static bool ViewTypeMatches(ViewType::Type type, ViewType::Type match) {
- if (type == match)
- return true;
-
- // INVALID means match all.
- if (match == ViewType::INVALID)
- return true;
-
- // TODO(erikkay) for now, special case mole as a type of toolstrip.
- // Perhaps this isn't the right long-term thing to do.
- if (match == ViewType::EXTENSION_TOOLSTRIP &&
- type == ViewType::EXTENSION_MOLE) {
- return true;
- }
-
- return false;
- }
-
static v8::Handle<v8::Value> GetExtensionViews(const v8::Arguments& args) {
if (args.Length() != 2)
return v8::Undefined();
@@ -155,8 +135,6 @@ class ExtensionImpl : public ExtensionBase {
ViewType::Type view_type = ViewType::INVALID;
if (view_type_string == "TOOLSTRIP") {
view_type = ViewType::EXTENSION_TOOLSTRIP;
- } else if (view_type_string == "MOLE") {
- view_type = ViewType::EXTENSION_MOLE;
} else if (view_type_string == "BACKGROUND") {
view_type = ViewType::EXTENSION_BACKGROUND_PAGE;
} else if (view_type_string == "TAB") {
@@ -176,7 +154,7 @@ class ExtensionImpl : public ExtensionBase {
std::set<RenderView* >::iterator it =
render_view_set_pointer->render_view_set_.begin();
for (; it != render_view_set_pointer->render_view_set_.end(); ++it) {
- if (!ViewTypeMatches((*it)->view_type(), view_type))
+ if (view_type != ViewType::INVALID && (*it)->view_type() != view_type)
continue;
GURL url = (*it)->webview()->GetMainFrame()->url();
@@ -418,25 +396,3 @@ v8::Handle<v8::Value>
return v8::ThrowException(v8::Exception::Error(
v8::String::New(error_msg.c_str())));
}
-
-// static
-void ExtensionProcessBindings::SetViewType(WebView* view,
- ViewType::Type type) {
- DCHECK(type == ViewType::EXTENSION_MOLE ||
- type == ViewType::EXTENSION_TOOLSTRIP);
- const char* type_str;
- if (type == ViewType::EXTENSION_MOLE)
- type_str = "mole";
- else if (type == ViewType::EXTENSION_TOOLSTRIP)
- type_str = "toolstrip";
- else
- return;
-
- v8::HandleScope handle_scope;
- WebFrame* frame = view->GetMainFrame();
- v8::Local<v8::Context> context = frame->mainWorldScriptContext();
- v8::Handle<v8::Value> argv[1];
- argv[0] = v8::String::New(type_str);
- bindings_utils::CallFunctionInContext(context, "setViewType",
- arraysize(argv), argv);
-}
diff --git a/chrome/renderer/extensions/extension_process_bindings.h b/chrome/renderer/extensions/extension_process_bindings.h
index 1777658..bea3e91 100644
--- a/chrome/renderer/extensions/extension_process_bindings.h
+++ b/chrome/renderer/extensions/extension_process_bindings.h
@@ -11,12 +11,10 @@
#include <string>
#include <vector>
-#include "chrome/common/view_types.h"
#include "v8/include/v8.h"
class GURL;
class URLPattern;
-class WebView;
class ExtensionProcessBindings {
public:
@@ -38,7 +36,7 @@ class ExtensionProcessBindings {
// Sets the host permissions for a particular extension.
static void SetHostPermissions(const GURL& extension_url,
- const std::vector<URLPattern>& permissions);
+ const std::vector<URLPattern>& permissions);
// Check if the extension in the currently running context has permission to
// access the given extension function. Must be called with a valid V8
@@ -49,11 +47,6 @@ class ExtensionProcessBindings {
// denied. Must be called with a valid V8 context in scope.
static v8::Handle<v8::Value> ThrowPermissionDeniedException(
const std::string& function_name);
-
- // For EXTENSION_* |type| values, adds/replaces a special class name on to
- // the document element (e.g. "extension_toolstrip", "extension_mole") so
- // that the page can use CSS rules to control its display appropriately.
- static void SetViewType(WebView* view, ViewType::Type type);
};
#endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_PROCESS_BINDINGS_H_