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 *browser_handle = 0; | |
Paweł Hajdan Jr.
2011/02/15 08:50:14
Generally automation client is expected to know th
| |
4624 if (tab_tracker_->ContainsHandle(tab_handle)) { | |
4625 NavigationController* controller = tab_tracker_->GetResource(tab_handle); | |
4626 int index; | |
4627 Browser* browser = Browser::GetBrowserForController(controller, &index); | |
4628 if (browser) | |
4629 *browser_handle = browser_tracker_->Add(browser); | |
4630 } | |
4631 } | |
4632 | |
4619 // TODO(brettw) change this to accept GURLs when history supports it | 4633 // TODO(brettw) change this to accept GURLs when history supports it |
4620 void TestingAutomationProvider::OnRedirectQueryComplete( | 4634 void TestingAutomationProvider::OnRedirectQueryComplete( |
4621 HistoryService::Handle request_handle, | 4635 HistoryService::Handle request_handle, |
4622 GURL from_url, | 4636 GURL from_url, |
4623 bool success, | 4637 bool success, |
4624 history::RedirectList* redirects) { | 4638 history::RedirectList* redirects) { |
4625 DCHECK(request_handle == redirect_query_); | 4639 DCHECK(request_handle == redirect_query_); |
4626 DCHECK(reply_message_ != NULL); | 4640 DCHECK(reply_message_ != NULL); |
4627 | 4641 |
4628 std::vector<GURL> redirects_gurl; | 4642 std::vector<GURL> redirects_gurl; |
(...skipping 22 matching lines...) Expand all Loading... | |
4651 // If you change this, update Observer for NotificationType::SESSION_END | 4665 // If you change this, update Observer for NotificationType::SESSION_END |
4652 // below. | 4666 // below. |
4653 MessageLoop::current()->PostTask(FROM_HERE, | 4667 MessageLoop::current()->PostTask(FROM_HERE, |
4654 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); | 4668 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); |
4655 } | 4669 } |
4656 } | 4670 } |
4657 | 4671 |
4658 void TestingAutomationProvider::OnRemoveProvider() { | 4672 void TestingAutomationProvider::OnRemoveProvider() { |
4659 AutomationProviderList::GetInstance()->RemoveProvider(this); | 4673 AutomationProviderList::GetInstance()->RemoveProvider(this); |
4660 } | 4674 } |
OLD | NEW |