diff options
author | robertshield@google.com <robertshield@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 16:13:30 +0000 |
---|---|---|
committer | robertshield@google.com <robertshield@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 16:13:30 +0000 |
commit | 97037a1032478f976048762aed86d963dc531c2f (patch) | |
tree | cae278fccda2bec154ff08c9fd5d66eae943de90 /chrome | |
parent | 876d150b06190f15ea9c9758638f7b70714e37bd (diff) | |
download | chromium_src-97037a1032478f976048762aed86d963dc531c2f.zip chromium_src-97037a1032478f976048762aed86d963dc531c2f.tar.gz chromium_src-97037a1032478f976048762aed86d963dc531c2f.tar.bz2 |
Revert of r16741 which appeared to cause a perf regression (???) on the builder.
TBR=thomasvl
Review URL: http://codereview.chromium.org/115708
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 98 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 1 | ||||
-rw-r--r-- | chrome/chrome.gyp | 2 | ||||
-rw-r--r-- | chrome/common/automation_constants.cc | 15 | ||||
-rw-r--r-- | chrome/common/automation_constants.h | 19 | ||||
-rw-r--r-- | chrome/common/common.vcproj | 8 | ||||
-rw-r--r-- | chrome/test/automation/automation_constants.h | 4 | ||||
-rw-r--r-- | chrome/test/automation/automation_messages_internal.h | 8 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.cc | 4 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.h | 4 |
10 files changed, 3 insertions, 160 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 0923492..641e883 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -11,7 +11,6 @@ #include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/thread.h" -#include "base/values.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/app_modal_dialog.h" #include "chrome/browser/app_modal_dialog_queue.h" @@ -28,22 +27,17 @@ #include "chrome/browser/find_bar_controller.h" #include "chrome/browser/find_notification_details.h" #include "chrome/browser/location_bar.h" -#include "chrome/browser/profile_manager.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/ssl/ssl_manager.h" #include "chrome/browser/ssl/ssl_blocking_page.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" -#include "chrome/common/automation_constants.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/json_value_serializer.h" #include "chrome/common/notification_service.h" #include "chrome/common/platform_util.h" #include "chrome/common/pref_service.h" #include "chrome/test/automation/automation_messages.h" #include "net/base/cookie_monster.h" -#include "net/proxy/proxy_service.h" -#include "net/proxy/proxy_config_service_fixed.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_filter.h" @@ -998,7 +992,6 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { HandleInspectElementRequest) IPC_MESSAGE_HANDLER(AutomationMsg_SetFilteredInet, SetFilteredInet) IPC_MESSAGE_HANDLER(AutomationMsg_DownloadDirectory, GetDownloadDirectory) - IPC_MESSAGE_HANDLER(AutomationMsg_SetProxyConfig, SetProxyConfig); IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_OpenNewBrowserWindow, OpenNewBrowserWindow) IPC_MESSAGE_HANDLER(AutomationMsg_WindowForBrowser, GetWindowForBrowser) @@ -2167,97 +2160,6 @@ void AutomationProvider::SetFilteredInet(const IPC::Message& message, new SetFilteredInetTask(enabled)); } -class SetProxyConfigTask : public Task { - public: - explicit SetProxyConfigTask(net::ProxyService* proxy_service, - const std::string& new_proxy_config) - : proxy_service_(proxy_service), proxy_config_(new_proxy_config) {} - virtual void Run() { - // First, deserialize the JSON string. If this fails, log and bail. - JSONStringValueSerializer deserializer(proxy_config_); - std::string error_message; - scoped_ptr<Value> root(deserializer.Deserialize(&error_message)); - if (!root.get() || root->GetType() != Value::TYPE_DICTIONARY) { - DLOG(WARNING) << "Received bad JSON string for ProxyConfig: " - << error_message; - return; - } - - scoped_ptr<DictionaryValue> dict( - static_cast<DictionaryValue*>(root.release())); - // Now put together a proxy configuration from the deserialized string. - net::ProxyConfig pc; - PopulateProxyConfig(*dict.get(), &pc); - - DCHECK(proxy_service_); - scoped_ptr<net::ProxyConfigService> proxy_config_service( - new net::ProxyConfigServiceFixed(pc)); - proxy_service_->ResetConfigService(proxy_config_service.release()); - } - - void PopulateProxyConfig(const DictionaryValue& dict, net::ProxyConfig* pc) { - DCHECK(pc); - bool no_proxy = false; - if (dict.GetBoolean(automation::kJSONProxyNoProxy, &no_proxy)) { - // Make no changes to the ProxyConfig. - return; - } - bool auto_config; - if (dict.GetBoolean(automation::kJSONProxyAutoconfig, &auto_config)) { - pc->auto_detect = true; - } - std::string pac_url; - if (dict.GetString(automation::kJSONProxyPacUrl, &pac_url)) { - pc->pac_url = GURL(pac_url); - } - std::string proxy_bypass_list; - if (dict.GetString(automation::kJSONProxyBypassList, &proxy_bypass_list)) { - pc->ParseNoProxyList(proxy_bypass_list); - } - std::string proxy_server; - if (dict.GetString(automation::kJSONProxyServer, &proxy_server)) { - pc->proxy_rules.ParseFromString(proxy_server); - } - } - - private: - net::ProxyService* proxy_service_; - std::string proxy_config_; -}; - - -void AutomationProvider::SetProxyConfig(const std::string& new_proxy_config) { - URLRequestContext* context = Profile::GetDefaultRequestContext(); - // If we don't have a default request context yet then we have to create - // one. - bool run_on_ui_thread = false; - if (!context) { - FilePath user_data_dir; - PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); - ProfileManager* profile_manager = g_browser_process->profile_manager(); - DCHECK(profile_manager); - Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); - DCHECK(profile); - context = profile->GetRequestContext(); - run_on_ui_thread = true; - } - DCHECK(context); - // Every URLRequestContext should have a proxy service. - net::ProxyService* proxy_service = context->proxy_service(); - DCHECK(proxy_service); - - // If we just now created the URLRequestContext then we can immediately - // set the proxy settings on this (the UI) thread. If there was already - // a URLRequestContext, then run the reset on the IO thread. - if (run_on_ui_thread) { - SetProxyConfigTask set_proxy_config_task(proxy_service, new_proxy_config); - set_proxy_config_task.Run(); - } else { - g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, - new SetProxyConfigTask(proxy_service, new_proxy_config)); - } -} - void AutomationProvider::GetDownloadDirectory( int handle, std::wstring* download_directory) { DLOG(INFO) << "Handling download directory request"; diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 9de02a6..d90e2dc29 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -211,7 +211,6 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, IPC::Message* reply_message); void GetShelfVisibility(int handle, bool* visible); void SetFilteredInet(const IPC::Message& message, bool enabled); - void SetProxyConfig(const std::string& new_proxy_config); #if defined(OS_WIN) // TODO(port): Replace POINT. diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 16fefc5..328327e 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -255,8 +255,6 @@ 'common/app_cache/app_cache_dispatcher.h', 'common/app_cache/app_cache_dispatcher_host.cc', 'common/app_cache/app_cache_dispatcher_host.h', - 'common/automation_constants.cc', - 'common/automation_constants.h', 'common/bindings_policy.h', 'common/child_process.cc', 'common/child_process.h', diff --git a/chrome/common/automation_constants.cc b/chrome/common/automation_constants.cc deleted file mode 100644 index 185d57b..0000000 --- a/chrome/common/automation_constants.cc +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2006-2009 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/common/automation_constants.h" - -namespace automation { -// JSON value labels for proxy settings that are passed in via -// AutomationMsg_SetProxyConfig. -const wchar_t kJSONProxyAutoconfig[] = L"proxy.autoconfig"; -const wchar_t kJSONProxyNoProxy[] = L"proxy.no_proxy"; -const wchar_t kJSONProxyPacUrl[] = L"proxy.pac_url"; -const wchar_t kJSONProxyBypassList[] = L"proxy.bypass_list"; -const wchar_t kJSONProxyServer[] = L"proxy.server"; -} diff --git a/chrome/common/automation_constants.h b/chrome/common/automation_constants.h deleted file mode 100644 index 9c31bd1..0000000 --- a/chrome/common/automation_constants.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2006-2009 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_COMMON_AUTOMATION_CONSTANTS_H__ -#define CHROME_COMMON_AUTOMATION_CONSTANTS_H__ - -namespace automation { -// JSON value labels for proxy settings that are passed in via -// AutomationMsg_SetProxyConfig. These are here since they are used by both -// AutomationProvider and AutomationProxy. -extern const wchar_t kJSONProxyAutoconfig[]; -extern const wchar_t kJSONProxyNoProxy[]; -extern const wchar_t kJSONProxyPacUrl[]; -extern const wchar_t kJSONProxyBypassList[]; -extern const wchar_t kJSONProxyServer[]; -} - -#endif // CHROME_COMMON_AUTOMATION_CONSTANTS_H__ diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj index 216a551..25b8b16 100644 --- a/chrome/common/common.vcproj +++ b/chrome/common/common.vcproj @@ -306,14 +306,6 @@ </File> </Filter> <File - RelativePath=".\automation_constants.cc" - > - </File> - <File - RelativePath=".\automation_constants.h" - > - </File> - <File RelativePath=".\bindings_policy.h" > </File> diff --git a/chrome/test/automation/automation_constants.h b/chrome/test/automation/automation_constants.h index b08836d..06d13e0 100644 --- a/chrome/test/automation/automation_constants.h +++ b/chrome/test/automation/automation_constants.h @@ -6,8 +6,8 @@ #define CHROME_TEST_AUTOMATION_AUTOMATION_CONSTANTS_H__ namespace automation { -// Amount of time to wait before querying the browser. -static const int kSleepTime = 250; + // Amount of time to wait before querying the browser. + static const int kSleepTime = 250; } // Used by AutomationProxy, declared here so that other headers don't need diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index b1f854e..eaf5c4a 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -335,12 +335,6 @@ IPC_BEGIN_MESSAGES(Automation) IPC_MESSAGE_ROUTED1(AutomationMsg_SetFilteredInet, bool /* enabled */) - // This message tells the browser to start using the new proxy configuration - // represented by the given JSON string. The parameters used in the JSON - // string are defined in automation_constants.h. - IPC_SYNC_MESSAGE_ROUTED1_0(AutomationMsg_SetProxyConfig, - std::string /* proxy_config_json_string */) - // Gets the directory that downloads will occur in for the active profile. IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_DownloadDirectory, int /* tab_handle */, @@ -760,7 +754,7 @@ IPC_BEGIN_MESSAGES(Automation) // A message for an external host. IPC_MESSAGE_ROUTED4(AutomationMsg_ForwardMessageToExternalHost, - int, /* handle */ + int, // handle std::string /* message */, std::string /* origin */, std::string /* target */) diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index 9fc8193..3f6508b 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -370,10 +370,6 @@ bool AutomationProxy::SetFilteredInet(bool enabled) { return Send(new AutomationMsg_SetFilteredInet(0, enabled)); } -bool AutomationProxy::SendProxyConfig(const std::string& new_proxy_config) { - return Send(new AutomationMsg_SetProxyConfig(0, new_proxy_config)); -} - void AutomationProxy::Disconnect() { channel_.reset(); } diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index 75c76cd..0b8ad57 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -145,10 +145,6 @@ class AutomationProxy : public IPC::Channel::Listener, // false if the message fails to send to the browser. bool SetFilteredInet(bool enabled); - // Sends the browser a new proxy configuration to start using. Returns true - // if the proxy config was successfully sent, false otherwise. - bool SendProxyConfig(const std::string& new_proxy_config); - // These methods are intended to be called by the background thread // to signal that the given event has occurred, and that any corresponding // Wait... function can return. |