OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 #include "policy/policy_constants.h" | 145 #include "policy/policy_constants.h" |
146 #endif | 146 #endif |
147 | 147 |
148 #if defined(OS_CHROMEOS) | 148 #if defined(OS_CHROMEOS) |
149 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 149 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
150 #include "chrome/browser/ui/webui/active_downloads_ui.h" | 150 #include "chrome/browser/ui/webui/active_downloads_ui.h" |
151 #else | 151 #else |
152 #include "chrome/browser/download/download_shelf.h" | 152 #include "chrome/browser/download/download_shelf.h" |
153 #endif | 153 #endif |
154 | 154 |
| 155 #if defined(OS_MACOSX) |
| 156 #include "base/mach_ipc_mac.h" |
| 157 #endif |
| 158 |
155 using automation::Error; | 159 using automation::Error; |
156 using automation::ErrorCode; | 160 using automation::ErrorCode; |
157 using automation_util::SendErrorIfModalDialogActive; | 161 using automation_util::SendErrorIfModalDialogActive; |
158 using content::BrowserChildProcessHostIterator; | 162 using content::BrowserChildProcessHostIterator; |
159 using content::BrowserThread; | 163 using content::BrowserThread; |
160 using content::ChildProcessHost; | 164 using content::ChildProcessHost; |
161 using content::DownloadItem; | 165 using content::DownloadItem; |
162 using content::DownloadManager; | 166 using content::DownloadManager; |
163 using content::NavigationController; | 167 using content::NavigationController; |
164 using content::NavigationEntry; | 168 using content::NavigationEntry; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 IPC_BEGIN_MESSAGE_MAP_EX(TestingAutomationProvider, | 316 IPC_BEGIN_MESSAGE_MAP_EX(TestingAutomationProvider, |
313 message, | 317 message, |
314 deserialize_success) | 318 deserialize_success) |
315 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CloseBrowser, CloseBrowser) | 319 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CloseBrowser, CloseBrowser) |
316 IPC_MESSAGE_HANDLER(AutomationMsg_CloseBrowserRequestAsync, | 320 IPC_MESSAGE_HANDLER(AutomationMsg_CloseBrowserRequestAsync, |
317 CloseBrowserAsync) | 321 CloseBrowserAsync) |
318 IPC_MESSAGE_HANDLER(AutomationMsg_ActivateTab, ActivateTab) | 322 IPC_MESSAGE_HANDLER(AutomationMsg_ActivateTab, ActivateTab) |
319 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_AppendTab, AppendTab) | 323 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_AppendTab, AppendTab) |
320 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_AppendBackgroundTab, | 324 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_AppendBackgroundTab, |
321 AppendBackgroundTab) | 325 AppendBackgroundTab) |
| 326 IPC_MESSAGE_HANDLER(AutomationMsg_GetMachPortCount, GetMachPortCount) |
322 IPC_MESSAGE_HANDLER(AutomationMsg_ActiveTabIndex, GetActiveTabIndex) | 327 IPC_MESSAGE_HANDLER(AutomationMsg_ActiveTabIndex, GetActiveTabIndex) |
323 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CloseTab, CloseTab) | 328 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CloseTab, CloseTab) |
324 IPC_MESSAGE_HANDLER(AutomationMsg_GetCookies, GetCookies) | 329 IPC_MESSAGE_HANDLER(AutomationMsg_GetCookies, GetCookies) |
325 IPC_MESSAGE_HANDLER(AutomationMsg_SetCookie, SetCookie) | 330 IPC_MESSAGE_HANDLER(AutomationMsg_SetCookie, SetCookie) |
326 IPC_MESSAGE_HANDLER(AutomationMsg_DeleteCookie, DeleteCookie) | 331 IPC_MESSAGE_HANDLER(AutomationMsg_DeleteCookie, DeleteCookie) |
327 IPC_MESSAGE_HANDLER(AutomationMsg_ShowCollectedCookiesDialog, | 332 IPC_MESSAGE_HANDLER(AutomationMsg_ShowCollectedCookiesDialog, |
328 ShowCollectedCookiesDialog) | 333 ShowCollectedCookiesDialog) |
329 IPC_MESSAGE_HANDLER_DELAY_REPLY( | 334 IPC_MESSAGE_HANDLER_DELAY_REPLY( |
330 AutomationMsg_NavigateToURLBlockUntilNavigationsComplete, | 335 AutomationMsg_NavigateToURLBlockUntilNavigationsComplete, |
331 NavigateToURLBlockUntilNavigationsComplete) | 336 NavigateToURLBlockUntilNavigationsComplete) |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 // Appending tab failed. Clean up and send failure response. | 597 // Appending tab failed. Clean up and send failure response. |
593 if (observer) | 598 if (observer) |
594 delete observer; | 599 delete observer; |
595 | 600 |
596 AutomationMsg_AppendBackgroundTab::WriteReplyParams(reply_message, | 601 AutomationMsg_AppendBackgroundTab::WriteReplyParams(reply_message, |
597 append_tab_response); | 602 append_tab_response); |
598 Send(reply_message); | 603 Send(reply_message); |
599 } | 604 } |
600 } | 605 } |
601 | 606 |
| 607 void TestingAutomationProvider::GetMachPortCount(int* port_count) { |
| 608 #if defined(OS_MACOSX) |
| 609 base::mac::GetNumberOfMachPorts(mach_task_self(), port_count); |
| 610 #else |
| 611 *port_count = 0; |
| 612 #endif |
| 613 } |
| 614 |
602 void TestingAutomationProvider::GetActiveTabIndex(int handle, | 615 void TestingAutomationProvider::GetActiveTabIndex(int handle, |
603 int* active_tab_index) { | 616 int* active_tab_index) { |
604 *active_tab_index = -1; // -1 is the error code | 617 *active_tab_index = -1; // -1 is the error code |
605 if (browser_tracker_->ContainsHandle(handle)) { | 618 if (browser_tracker_->ContainsHandle(handle)) { |
606 Browser* browser = browser_tracker_->GetResource(handle); | 619 Browser* browser = browser_tracker_->GetResource(handle); |
607 *active_tab_index = browser->active_index(); | 620 *active_tab_index = browser->active_index(); |
608 } | 621 } |
609 } | 622 } |
610 | 623 |
611 void TestingAutomationProvider::CloseTab(int tab_handle, | 624 void TestingAutomationProvider::CloseTab(int tab_handle, |
(...skipping 6246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6858 | 6871 |
6859 Send(reply_message_); | 6872 Send(reply_message_); |
6860 redirect_query_ = 0; | 6873 redirect_query_ = 0; |
6861 reply_message_ = NULL; | 6874 reply_message_ = NULL; |
6862 } | 6875 } |
6863 | 6876 |
6864 void TestingAutomationProvider::OnRemoveProvider() { | 6877 void TestingAutomationProvider::OnRemoveProvider() { |
6865 if (g_browser_process) | 6878 if (g_browser_process) |
6866 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6879 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6867 } | 6880 } |
OLD | NEW |