diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-11 03:46:36 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-11 03:46:36 +0000 |
commit | 2e49fc3cceaa87f1472fae156271e594cfa140d3 (patch) | |
tree | 7c66fb8fb081e24a76148140397e07863e1ea2cd /chrome/browser/automation | |
parent | 03f659553ba83358efe2bf021cd0a8623c94fb07 (diff) | |
download | chromium_src-2e49fc3cceaa87f1472fae156271e594cfa140d3.zip chromium_src-2e49fc3cceaa87f1472fae156271e594cfa140d3.tar.gz chromium_src-2e49fc3cceaa87f1472fae156271e594cfa140d3.tar.bz2 |
Revert "Add support to the automation provider to test sending browser"
This reverts commit 9b7fbb1e720ab2071b30531fd0266918c4e68d12.
Review URL: http://codereview.chromium.org/122022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18147 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation')
4 files changed, 2 insertions, 61 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 4b2510a..dcb6afe 100755 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -6,7 +6,6 @@ #include "app/message_box_flags.h" #include "base/file_version_info.h" -#include "base/json_reader.h" #include "base/message_loop.h" #include "base/path_service.h" #include "base/stl_util-inl.h" @@ -18,7 +17,6 @@ #include "chrome/browser/app_modal_dialog_queue.h" #include "chrome/browser/automation/automation_extension_function.h" #include "chrome/browser/automation/automation_provider_list.h" -#include "chrome/browser/automation/extension_automation_constants.h" #include "chrome/browser/automation/extension_port_container.h" #include "chrome/browser/automation/url_request_failed_dns_job.h" #include "chrome/browser/automation/url_request_mock_http_job.h" @@ -28,7 +26,6 @@ #include "chrome/browser/dom_operation_notification_details.h" #include "chrome/browser/download/download_manager.h" #include "chrome/browser/download/download_shelf.h" -#include "chrome/browser/extensions/extension_message_service.h" #include "chrome/browser/find_bar.h" #include "chrome/browser/find_bar_controller.h" #include "chrome/browser/find_notification_details.h" @@ -2734,18 +2731,13 @@ void AutomationProvider::OnMessageFromExternalHost(int handle, } if (AutomationExtensionFunction::InterceptMessageFromExternalHost( - view_host, message, origin, target)) { + view_host, message, origin, target)) { // Message was diverted. return; } if (ExtensionPortContainer::InterceptMessageFromExternalHost(message, - origin, target, this, view_host, handle)) { - // Message was diverted. - return; - } - - if (InterceptBrowserEventMessageFromExternalHost(message, origin, target)) { + origin, target, this, view_host, handle)) { // Message was diverted. return; } @@ -2753,47 +2745,6 @@ void AutomationProvider::OnMessageFromExternalHost(int handle, view_host->ForwardMessageFromExternalHost(message, origin, target); } } - -bool AutomationProvider::InterceptBrowserEventMessageFromExternalHost( - const std::string& message, const std::string& origin, - const std::string& target) { - if (target != - extension_automation_constants::kAutomationBrowserEventRequestTarget) - return false; - - if (origin != extension_automation_constants::kAutomationOrigin) { - LOG(WARNING) << "Wrong origin on automation browser event " << origin; - return false; - } - - // The message is a JSON-encoded array with two elements, both strings. The - // first is the name of the event to dispatch. The second is a JSON-encoding - // of the arguments specific to that event. - scoped_ptr<Value> message_value(JSONReader::Read(message, false)); - if (!message_value.get() || !message_value->IsType(Value::TYPE_LIST)) { - LOG(WARNING) << "Invalid browser event specified through automation"; - return false; - } - - const ListValue* args = static_cast<const ListValue*>(message_value.get()); - - std::string event_name; - if (!args->GetString(0, &event_name)) { - LOG(WARNING) << "No browser event name specified through automation"; - return false; - } - - std::string json_args; - if (!args->GetString(1, &json_args)) { - LOG(WARNING) << "No browser event args specified through automation"; - return false; - } - - ExtensionMessageService::GetInstance(profile()->GetRequestContext())-> - DispatchEventToRenderers(event_name.c_str(), json_args); - - return true; -} #endif // defined(OS_WIN) || defined(OS_LINUX) TabContents* AutomationProvider::GetTabContentsForHandle( diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index bfbae83..174faff 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -469,12 +469,6 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, bool success, HistoryService::RedirectList* redirects); - // Determine if the message from the external host represents a browser - // event, and if so dispatch it. - bool InterceptBrowserEventMessageFromExternalHost(const std::string& message, - const std::string& origin, - const std::string& target); - typedef ObserverList<NotificationObserver> NotificationObserverList; typedef std::map<NavigationController*, LoginHandler*> LoginHandlerMap; typedef std::map<int, ExtensionPortContainer*> PortContainerMap; diff --git a/chrome/browser/automation/extension_automation_constants.cc b/chrome/browser/automation/extension_automation_constants.cc index 6b99a41..425c634 100644 --- a/chrome/browser/automation/extension_automation_constants.cc +++ b/chrome/browser/automation/extension_automation_constants.cc @@ -24,6 +24,5 @@ const wchar_t kAutomationPortIdKey[] = L"portid"; const char kAutomationPortRequestTarget[] = "__priv_prtreq"; const char kAutomationPortResponseTarget[] = "__priv_prtres"; -const char kAutomationBrowserEventRequestTarget[] = "__priv_evtreq"; } // namespace extension_automation_constants diff --git a/chrome/browser/automation/extension_automation_constants.h b/chrome/browser/automation/extension_automation_constants.h index 06bd97d..4725bf3 100644 --- a/chrome/browser/automation/extension_automation_constants.h +++ b/chrome/browser/automation/extension_automation_constants.h @@ -35,9 +35,6 @@ extern const char kAutomationPortRequestTarget[]; // All external port message responses have this target. extern const char kAutomationPortResponseTarget[]; -// All external browser events have this target. -extern const char kAutomationBrowserEventRequestTarget[]; - // The command codes for our private port protocol. enum PrivatePortCommand { OPEN_CHANNEL = 0, |