Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: chrome/browser/automation/automation_provider.cc

Issue 5139001: Revert 66350 - Add named testing interface. This allows you to connect to a p... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/automation/automation_provider.cc
===================================================================
--- chrome/browser/automation/automation_provider.cc (revision 66367)
+++ chrome/browser/automation/automation_provider.cc (working copy)
@@ -113,9 +113,7 @@
AutomationProvider::AutomationProvider(Profile* profile)
: profile_(profile),
- reply_message_(NULL),
- is_connected_(false),
- initial_loads_complete_(false) {
+ reply_message_(NULL) {
TRACE_EVENT_BEGIN("AutomationProvider::AutomationProvider", 0, "");
browser_tracker_.reset(new AutomationBrowserTracker(this));
@@ -151,38 +149,23 @@
g_browser_process->ReleaseModule();
}
-bool AutomationProvider::InitializeChannel(const std::string& channel_id) {
- TRACE_EVENT_BEGIN("AutomationProvider::InitializeChannel", 0, "");
+void AutomationProvider::ConnectToChannel(const std::string& channel_id) {
+ TRACE_EVENT_BEGIN("AutomationProvider::ConnectToChannel", 0, "");
- std::string effective_channel_id = channel_id;
-
- // If the channel_id starts with kNamedInterfacePrefix, create a named IPC
- // server and listen on it, else connect as client to an existing IPC server
- bool use_named_interface =
- channel_id.find(automation::kNamedInterfacePrefix) == 0;
- if (use_named_interface) {
- effective_channel_id = channel_id.substr(
- strlen(automation::kNamedInterfacePrefix));
- if (effective_channel_id.length() <= 0)
- return false;
- }
-
if (!automation_resource_message_filter_.get()) {
automation_resource_message_filter_ = new AutomationResourceMessageFilter;
}
- channel_.reset(new IPC::SyncChannel(
- effective_channel_id,
- use_named_interface ? IPC::Channel::MODE_NAMED_SERVER
- : IPC::Channel::MODE_CLIENT,
- this,
- automation_resource_message_filter_,
- g_browser_process->io_thread()->message_loop(),
- true, g_browser_process->shutdown_event()));
+ channel_.reset(
+ new IPC::SyncChannel(channel_id, IPC::Channel::MODE_CLIENT, this,
+ automation_resource_message_filter_,
+ g_browser_process->io_thread()->message_loop(),
+ true, g_browser_process->shutdown_event()));
- TRACE_EVENT_END("AutomationProvider::InitializeChannel", 0, "");
+ // Send a hello message with our current automation protocol version.
+ channel_->Send(new AutomationMsg_Hello(0, GetProtocolVersion().c_str()));
- return true;
+ TRACE_EVENT_END("AutomationProvider::ConnectToChannel", 0, "");
}
std::string AutomationProvider::GetProtocolVersion() {
@@ -191,18 +174,13 @@
}
void AutomationProvider::SetExpectedTabCount(size_t expected_tabs) {
- if (expected_tabs == 0)
- OnInitialLoadsComplete();
- else
+ if (expected_tabs == 0) {
+ Send(new AutomationMsg_InitialLoadsComplete(0));
+ } else {
initial_load_observer_.reset(new InitialLoadObserver(expected_tabs, this));
+ }
}
-void AutomationProvider::OnInitialLoadsComplete() {
- initial_loads_complete_ = true;
- if (is_connected_)
- Send(new AutomationMsg_InitialLoadsComplete(0));
-}
-
NotificationObserver* AutomationProvider::AddNavigationStatusListener(
NavigationController* tab, IPC::Message* reply_message,
int number_of_navigations, bool include_current_navigation) {
@@ -349,17 +327,6 @@
return NULL;
}
-void AutomationProvider::OnChannelConnected(int pid) {
- is_connected_ = true;
- LOG(INFO) << "Testing channel connected, sending hello message";
-
- // Send a hello message with our current automation protocol version.
- chrome::VersionInfo version_info;
- channel_->Send(new AutomationMsg_Hello(0, version_info.Version()));
- if (initial_loads_complete_)
- Send(new AutomationMsg_InitialLoadsComplete(0));
-}
-
void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(AutomationProvider, message)
#if !defined(OS_MACOSX)
« no previous file with comments | « chrome/browser/automation/automation_provider.h ('k') | chrome/browser/automation/automation_provider_observers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698