diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-31 23:25:33 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-31 23:25:33 +0000 |
commit | f1a63d5f6bef794c761447e7dc7b1415b133bdb3 (patch) | |
tree | 297e66d439d262c54a22b0360aa6241082018d2e /chrome/browser/extensions | |
parent | c1443d84cafab2dc81650715b102afe4d28cb27b (diff) | |
download | chromium_src-f1a63d5f6bef794c761447e7dc7b1415b133bdb3.zip chromium_src-f1a63d5f6bef794c761447e7dc7b1415b133bdb3.tar.gz chromium_src-f1a63d5f6bef794c761447e7dc7b1415b133bdb3.tar.bz2 |
Revert "First steps towards webRequest extension API."
Seems to have broken the sync_integration_tests.
This reverts commit d6f8d16cd6a5ebdf019c4755e7d42aee8136abf1.
TBR=aa
BUG=60101
TEST=no
Review URL: http://codereview.chromium.org/6287029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73219 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
5 files changed, 0 insertions, 163 deletions
diff --git a/chrome/browser/extensions/extension_io_event_router.cc b/chrome/browser/extensions/extension_io_event_router.cc deleted file mode 100755 index c6b4d3e..0000000 --- a/chrome/browser/extensions/extension_io_event_router.cc +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2011 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. - -#include "chrome/browser/extensions/extension_io_event_router.h" - -#include "googleurl/src/gurl.h" -#include "chrome/browser/browser_thread.h" -#include "chrome/browser/extensions/extension_event_router.h" -#include "chrome/browser/profiles/profile.h" - -ExtensionIOEventRouter::ExtensionIOEventRouter(Profile* profile) - : profile_(profile) { -} - -ExtensionIOEventRouter::~ExtensionIOEventRouter() { -} - -void ExtensionIOEventRouter::DispatchEvent( - const std::string& event_name, const std::string& event_args) const { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, - &ExtensionIOEventRouter::DispatchEventOnUIThread, - event_name, event_args)); -} - -void ExtensionIOEventRouter::DispatchEventOnUIThread( - const std::string& event_name, const std::string& event_args) const { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - - // If the profile has gone away, we're shutting down. - if (!profile_) - return; - - profile_->GetExtensionEventRouter()->DispatchEventToRenderers( - event_name, event_args, profile_, GURL()); -} diff --git a/chrome/browser/extensions/extension_io_event_router.h b/chrome/browser/extensions/extension_io_event_router.h deleted file mode 100755 index 1a27890..0000000 --- a/chrome/browser/extensions/extension_io_event_router.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2011 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_BROWSER_EXTENSIONS_EXTENSION_IO_EVENT_ROUTER_H_ -#define CHROME_BROWSER_EXTENSIONS_EXTENSION_IO_EVENT_ROUTER_H_ -#pragma once - -#include <string> - -#include "base/ref_counted.h" - -class Profile; - -// For now, this just forwards events from the IO thread to the -// ExtensionEventRouter on the UI thread. -// TODO(mpcomplete): eventually I want this to have its own copy of the event -// listeners so it can bypass the jump to the UI thread. -class ExtensionIOEventRouter - : public base::RefCountedThreadSafe<ExtensionIOEventRouter> { - public: - explicit ExtensionIOEventRouter(Profile* profile); - ~ExtensionIOEventRouter(); - - void DestroyingProfile() { profile_ = NULL; } - - // Dispatch the named event to every extension listening to that event. - void DispatchEvent(const std::string& event_name, - const std::string& event_args) const; - - private: - Profile* profile_; - - void DispatchEventOnUIThread(const std::string& event_name, - const std::string& event_args) const; - - DISALLOW_COPY_AND_ASSIGN(ExtensionIOEventRouter); -}; - -#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_IO_EVENT_ROUTER_H_ diff --git a/chrome/browser/extensions/extension_webrequest_api.cc b/chrome/browser/extensions/extension_webrequest_api.cc deleted file mode 100755 index 3ca3fca..0000000 --- a/chrome/browser/extensions/extension_webrequest_api.cc +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2011 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. - -#include "chrome/browser/extensions/extension_webrequest_api.h" - -#include "base/json/json_writer.h" -#include "base/values.h" -#include "chrome/browser/extensions/extension_io_event_router.h" -#include "chrome/browser/extensions/extension_webrequest_api_constants.h" -#include "googleurl/src/gurl.h" - -namespace keys = extension_webrequest_api_constants; - -// static -ExtensionWebRequestEventRouter* ExtensionWebRequestEventRouter::GetInstance() { - return Singleton<ExtensionWebRequestEventRouter>::get(); -} - -ExtensionWebRequestEventRouter::ExtensionWebRequestEventRouter() { -} - -ExtensionWebRequestEventRouter::~ExtensionWebRequestEventRouter() { -} - -void ExtensionWebRequestEventRouter::OnBeforeRequest( - const ExtensionIOEventRouter* event_router, const GURL& url, - const std::string& method) { - ListValue args; - DictionaryValue* dict = new DictionaryValue(); - dict->SetString(keys::kUrlKey, url.spec()); - dict->SetString(keys::kMethodKey, method); - // TODO(mpcomplete): implement - dict->SetInteger(keys::kTabIdKey, 0); - dict->SetInteger(keys::kRequestIdKey, 0); - dict->SetString(keys::kTypeKey, "main_frame"); - dict->SetInteger(keys::kTimeStampKey, 1); - args.Append(dict); - - std::string json_args; - base::JSONWriter::Write(&args, false, &json_args); - event_router->DispatchEvent(keys::kOnBeforeRequest, json_args); -} diff --git a/chrome/browser/extensions/extension_webrequest_api.h b/chrome/browser/extensions/extension_webrequest_api.h deleted file mode 100755 index 1945627..0000000 --- a/chrome/browser/extensions/extension_webrequest_api.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2011 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_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ -#define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ -#pragma once - -#include <string> - -#include "base/singleton.h" - -class ExtensionIOEventRouter; -class GURL; - -// IO thread -class ExtensionWebRequestEventRouter { - public: - static ExtensionWebRequestEventRouter* GetInstance(); - - // TODO(mpcomplete): additional params - void OnBeforeRequest(const ExtensionIOEventRouter* event_router, - const GURL& url, const std::string& method); - - private: - friend struct DefaultSingletonTraits<ExtensionWebRequestEventRouter>; - - ExtensionWebRequestEventRouter(); - ~ExtensionWebRequestEventRouter(); - - DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter); -}; - - -#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ diff --git a/chrome/browser/extensions/extension_webrequest_apitest.cc b/chrome/browser/extensions/extension_webrequest_apitest.cc index 7c25be8..833312f 100644 --- a/chrome/browser/extensions/extension_webrequest_apitest.cc +++ b/chrome/browser/extensions/extension_webrequest_apitest.cc @@ -12,10 +12,3 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebRequest) { ASSERT_TRUE(RunExtensionTest("webrequest/api")) << message_; } - -IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebRequestEvents) { - CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kEnableExperimentalExtensionApis); - - ASSERT_TRUE(RunExtensionTest("webrequest/events")) << message_; -} |