| 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 4198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4609 | 4611 |
| 4610 void TestingAutomationProvider::ResetToDefaultTheme() { | 4612 void TestingAutomationProvider::ResetToDefaultTheme() { |
| 4611 profile_->ClearTheme(); | 4613 profile_->ClearTheme(); |
| 4612 } | 4614 } |
| 4613 | 4615 |
| 4614 void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle( | 4616 void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle( |
| 4615 IPC::Message* reply_message) { | 4617 IPC::Message* reply_message) { |
| 4616 new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message); | 4618 new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message); |
| 4617 } | 4619 } |
| 4618 | 4620 |
| 4621 void TestingAutomationProvider::GetParentBrowserOfTab(int tab_handle, |
| 4622 int* browser_handle, |
| 4623 bool* success) { |
| 4624 *success = false; |
| 4625 if (tab_tracker_->ContainsHandle(tab_handle)) { |
| 4626 NavigationController* controller = tab_tracker_->GetResource(tab_handle); |
| 4627 int index; |
| 4628 Browser* browser = Browser::GetBrowserForController(controller, &index); |
| 4629 if (browser) { |
| 4630 *browser_handle = browser_tracker_->Add(browser); |
| 4631 *success = true; |
| 4632 } |
| 4633 } |
| 4634 } |
| 4635 |
| 4619 // TODO(brettw) change this to accept GURLs when history supports it | 4636 // TODO(brettw) change this to accept GURLs when history supports it |
| 4620 void TestingAutomationProvider::OnRedirectQueryComplete( | 4637 void TestingAutomationProvider::OnRedirectQueryComplete( |
| 4621 HistoryService::Handle request_handle, | 4638 HistoryService::Handle request_handle, |
| 4622 GURL from_url, | 4639 GURL from_url, |
| 4623 bool success, | 4640 bool success, |
| 4624 history::RedirectList* redirects) { | 4641 history::RedirectList* redirects) { |
| 4625 DCHECK(request_handle == redirect_query_); | 4642 DCHECK(request_handle == redirect_query_); |
| 4626 DCHECK(reply_message_ != NULL); | 4643 DCHECK(reply_message_ != NULL); |
| 4627 | 4644 |
| 4628 std::vector<GURL> redirects_gurl; | 4645 std::vector<GURL> redirects_gurl; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4651 // If you change this, update Observer for NotificationType::SESSION_END | 4668 // If you change this, update Observer for NotificationType::SESSION_END |
| 4652 // below. | 4669 // below. |
| 4653 MessageLoop::current()->PostTask(FROM_HERE, | 4670 MessageLoop::current()->PostTask(FROM_HERE, |
| 4654 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); | 4671 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); |
| 4655 } | 4672 } |
| 4656 } | 4673 } |
| 4657 | 4674 |
| 4658 void TestingAutomationProvider::OnRemoveProvider() { | 4675 void TestingAutomationProvider::OnRemoveProvider() { |
| 4659 AutomationProviderList::GetInstance()->RemoveProvider(this); | 4676 AutomationProviderList::GetInstance()->RemoveProvider(this); |
| 4660 } | 4677 } |
| OLD | NEW |