| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/automation/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "app/message_box_flags.h" | 9 #include "app/message_box_flags.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 automation_resource_message_filter_ = new AutomationResourceMessageFilter; | 154 automation_resource_message_filter_ = new AutomationResourceMessageFilter; |
| 155 } | 155 } |
| 156 | 156 |
| 157 channel_.reset( | 157 channel_.reset( |
| 158 new IPC::SyncChannel(channel_id, IPC::Channel::MODE_CLIENT, this, | 158 new IPC::SyncChannel(channel_id, IPC::Channel::MODE_CLIENT, this, |
| 159 g_browser_process->io_thread()->message_loop(), | 159 g_browser_process->io_thread()->message_loop(), |
| 160 true, g_browser_process->shutdown_event())); | 160 true, g_browser_process->shutdown_event())); |
| 161 channel_->AddFilter(automation_resource_message_filter_); | 161 channel_->AddFilter(automation_resource_message_filter_); |
| 162 | 162 |
| 163 // Send a hello message with our current automation protocol version. | 163 // Send a hello message with our current automation protocol version. |
| 164 channel_->Send(new AutomationMsg_Hello(0, GetProtocolVersion().c_str())); | 164 channel_->Send(new AutomationMsg_Hello(GetProtocolVersion().c_str())); |
| 165 | 165 |
| 166 TRACE_EVENT_END("AutomationProvider::ConnectToChannel", 0, ""); | 166 TRACE_EVENT_END("AutomationProvider::ConnectToChannel", 0, ""); |
| 167 } | 167 } |
| 168 | 168 |
| 169 std::string AutomationProvider::GetProtocolVersion() { | 169 std::string AutomationProvider::GetProtocolVersion() { |
| 170 chrome::VersionInfo version_info; | 170 chrome::VersionInfo version_info; |
| 171 return version_info.Version().c_str(); | 171 return version_info.Version().c_str(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void AutomationProvider::SetExpectedTabCount(size_t expected_tabs) { | 174 void AutomationProvider::SetExpectedTabCount(size_t expected_tabs) { |
| 175 if (expected_tabs == 0) { | 175 if (expected_tabs == 0) { |
| 176 Send(new AutomationMsg_InitialLoadsComplete(0)); | 176 Send(new AutomationMsg_InitialLoadsComplete()); |
| 177 } else { | 177 } else { |
| 178 initial_load_observer_.reset(new InitialLoadObserver(expected_tabs, this)); | 178 initial_load_observer_.reset(new InitialLoadObserver(expected_tabs, this)); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 NotificationObserver* AutomationProvider::AddNavigationStatusListener( | 182 NotificationObserver* AutomationProvider::AddNavigationStatusListener( |
| 183 NavigationController* tab, IPC::Message* reply_message, | 183 NavigationController* tab, IPC::Message* reply_message, |
| 184 int number_of_navigations, bool include_current_navigation) { | 184 int number_of_navigations, bool include_current_navigation) { |
| 185 NotificationObserver* observer = | 185 NotificationObserver* observer = |
| 186 new NavigationNotificationObserver(tab, this, reply_message, | 186 new NavigationNotificationObserver(tab, this, reply_message, |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 } | 981 } |
| 982 } | 982 } |
| 983 } | 983 } |
| 984 | 984 |
| 985 void AutomationProvider::SaveAsAsync(int tab_handle) { | 985 void AutomationProvider::SaveAsAsync(int tab_handle) { |
| 986 NavigationController* tab = NULL; | 986 NavigationController* tab = NULL; |
| 987 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); | 987 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); |
| 988 if (tab_contents) | 988 if (tab_contents) |
| 989 tab_contents->OnSavePage(); | 989 tab_contents->OnSavePage(); |
| 990 } | 990 } |
| OLD | NEW |