OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 IPC_MESSAGE_HANDLER(AutomationMsg_GetPageCurrentEncoding, | 391 IPC_MESSAGE_HANDLER(AutomationMsg_GetPageCurrentEncoding, |
392 GetPageCurrentEncoding) | 392 GetPageCurrentEncoding) |
393 IPC_MESSAGE_HANDLER(AutomationMsg_ShutdownSessionService, | 393 IPC_MESSAGE_HANDLER(AutomationMsg_ShutdownSessionService, |
394 ShutdownSessionService) | 394 ShutdownSessionService) |
395 IPC_MESSAGE_HANDLER(AutomationMsg_SetContentSetting, SetContentSetting) | 395 IPC_MESSAGE_HANDLER(AutomationMsg_SetContentSetting, SetContentSetting) |
396 IPC_MESSAGE_HANDLER(AutomationMsg_LoadBlockedPlugins, LoadBlockedPlugins) | 396 IPC_MESSAGE_HANDLER(AutomationMsg_LoadBlockedPlugins, LoadBlockedPlugins) |
397 IPC_MESSAGE_HANDLER(AutomationMsg_ResetToDefaultTheme, ResetToDefaultTheme) | 397 IPC_MESSAGE_HANDLER(AutomationMsg_ResetToDefaultTheme, ResetToDefaultTheme) |
398 IPC_MESSAGE_HANDLER_DELAY_REPLY( | 398 IPC_MESSAGE_HANDLER_DELAY_REPLY( |
399 AutomationMsg_WaitForProcessLauncherThreadToGoIdle, | 399 AutomationMsg_WaitForProcessLauncherThreadToGoIdle, |
400 WaitForProcessLauncherThreadToGoIdle) | 400 WaitForProcessLauncherThreadToGoIdle) |
| 401 IPC_MESSAGE_HANDLER(AutomationMsg_GetParentBrowserOfTab, |
| 402 GetParentBrowserOfTab) |
401 | 403 |
402 IPC_MESSAGE_UNHANDLED( | 404 IPC_MESSAGE_UNHANDLED( |
403 handled = AutomationProvider::OnMessageReceived(message)) | 405 handled = AutomationProvider::OnMessageReceived(message)) |
404 IPC_END_MESSAGE_MAP() | 406 IPC_END_MESSAGE_MAP() |
405 return handled; | 407 return handled; |
406 } | 408 } |
407 | 409 |
408 void TestingAutomationProvider::OnChannelError() { | 410 void TestingAutomationProvider::OnChannelError() { |
409 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) | 411 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) |
410 BrowserList::CloseAllBrowsersAndExit(); | 412 BrowserList::CloseAllBrowsersAndExit(); |
(...skipping 4200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4611 | 4613 |
4612 void TestingAutomationProvider::ResetToDefaultTheme() { | 4614 void TestingAutomationProvider::ResetToDefaultTheme() { |
4613 profile_->ClearTheme(); | 4615 profile_->ClearTheme(); |
4614 } | 4616 } |
4615 | 4617 |
4616 void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle( | 4618 void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle( |
4617 IPC::Message* reply_message) { | 4619 IPC::Message* reply_message) { |
4618 new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message); | 4620 new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message); |
4619 } | 4621 } |
4620 | 4622 |
| 4623 void TestingAutomationProvider::GetParentBrowserOfTab(int tab_handle, |
| 4624 int* browser_handle, |
| 4625 bool* success) { |
| 4626 *success = false; |
| 4627 if (tab_tracker_->ContainsHandle(tab_handle)) { |
| 4628 NavigationController* controller = tab_tracker_->GetResource(tab_handle); |
| 4629 int index; |
| 4630 Browser* browser = Browser::GetBrowserForController(controller, &index); |
| 4631 if (browser) { |
| 4632 *browser_handle = browser_tracker_->Add(browser); |
| 4633 *success = true; |
| 4634 } |
| 4635 } |
| 4636 } |
| 4637 |
4621 // TODO(brettw) change this to accept GURLs when history supports it | 4638 // TODO(brettw) change this to accept GURLs when history supports it |
4622 void TestingAutomationProvider::OnRedirectQueryComplete( | 4639 void TestingAutomationProvider::OnRedirectQueryComplete( |
4623 HistoryService::Handle request_handle, | 4640 HistoryService::Handle request_handle, |
4624 GURL from_url, | 4641 GURL from_url, |
4625 bool success, | 4642 bool success, |
4626 history::RedirectList* redirects) { | 4643 history::RedirectList* redirects) { |
4627 DCHECK(request_handle == redirect_query_); | 4644 DCHECK(request_handle == redirect_query_); |
4628 DCHECK(reply_message_ != NULL); | 4645 DCHECK(reply_message_ != NULL); |
4629 | 4646 |
4630 std::vector<GURL> redirects_gurl; | 4647 std::vector<GURL> redirects_gurl; |
(...skipping 22 matching lines...) Expand all Loading... |
4653 // If you change this, update Observer for NotificationType::SESSION_END | 4670 // If you change this, update Observer for NotificationType::SESSION_END |
4654 // below. | 4671 // below. |
4655 MessageLoop::current()->PostTask(FROM_HERE, | 4672 MessageLoop::current()->PostTask(FROM_HERE, |
4656 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); | 4673 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); |
4657 } | 4674 } |
4658 } | 4675 } |
4659 | 4676 |
4660 void TestingAutomationProvider::OnRemoveProvider() { | 4677 void TestingAutomationProvider::OnRemoveProvider() { |
4661 AutomationProviderList::GetInstance()->RemoveProvider(this); | 4678 AutomationProviderList::GetInstance()->RemoveProvider(this); |
4662 } | 4679 } |
OLD | NEW |