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/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include "app/message_box_flags.h" | 7 #include "app/message_box_flags.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 SendJSONRequest) | 412 SendJSONRequest) |
413 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForTabCountToBecome, | 413 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForTabCountToBecome, |
414 WaitForTabCountToBecome) | 414 WaitForTabCountToBecome) |
415 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForInfoBarCount, | 415 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForInfoBarCount, |
416 WaitForInfoBarCount) | 416 WaitForInfoBarCount) |
417 IPC_MESSAGE_HANDLER(AutomationMsg_GetPageCurrentEncoding, | 417 IPC_MESSAGE_HANDLER(AutomationMsg_GetPageCurrentEncoding, |
418 GetPageCurrentEncoding) | 418 GetPageCurrentEncoding) |
419 IPC_MESSAGE_HANDLER(AutomationMsg_ShutdownSessionService, | 419 IPC_MESSAGE_HANDLER(AutomationMsg_ShutdownSessionService, |
420 ShutdownSessionService) | 420 ShutdownSessionService) |
421 IPC_MESSAGE_HANDLER(AutomationMsg_SetContentSetting, SetContentSetting) | 421 IPC_MESSAGE_HANDLER(AutomationMsg_SetContentSetting, SetContentSetting) |
| 422 IPC_MESSAGE_HANDLER(AutomationMsg_LoadBlockedPlugins, LoadBlockedPlugins) |
422 IPC_MESSAGE_HANDLER(AutomationMsg_ResetToDefaultTheme, ResetToDefaultTheme) | 423 IPC_MESSAGE_HANDLER(AutomationMsg_ResetToDefaultTheme, ResetToDefaultTheme) |
423 | 424 |
424 IPC_MESSAGE_UNHANDLED(AutomationProvider::OnMessageReceived(message)); | 425 IPC_MESSAGE_UNHANDLED(AutomationProvider::OnMessageReceived(message)); |
425 IPC_END_MESSAGE_MAP() | 426 IPC_END_MESSAGE_MAP() |
426 } | 427 } |
427 | 428 |
428 void TestingAutomationProvider::OnChannelError() { | 429 void TestingAutomationProvider::OnChannelError() { |
429 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) | 430 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) |
430 BrowserList::CloseAllBrowsersAndExit(); | 431 BrowserList::CloseAllBrowsersAndExit(); |
431 AutomationProvider::OnChannelError(); | 432 AutomationProvider::OnChannelError(); |
(...skipping 3613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4045 if (host.empty()) { | 4046 if (host.empty()) { |
4046 map->SetDefaultContentSetting(content_type, setting); | 4047 map->SetDefaultContentSetting(content_type, setting); |
4047 } else { | 4048 } else { |
4048 map->SetContentSetting(HostContentSettingsMap::Pattern(host), | 4049 map->SetContentSetting(HostContentSettingsMap::Pattern(host), |
4049 content_type, "", setting); | 4050 content_type, "", setting); |
4050 } | 4051 } |
4051 *success = true; | 4052 *success = true; |
4052 } | 4053 } |
4053 } | 4054 } |
4054 | 4055 |
| 4056 void TestingAutomationProvider::LoadBlockedPlugins(int tab_handle, |
| 4057 bool* success) { |
| 4058 *success = false; |
| 4059 if (tab_tracker_->ContainsHandle(tab_handle)) { |
| 4060 NavigationController* nav = tab_tracker_->GetResource(tab_handle); |
| 4061 if (!nav) |
| 4062 return; |
| 4063 TabContents* contents = nav->tab_contents(); |
| 4064 if (!contents) |
| 4065 return; |
| 4066 contents->render_view_host()->LoadBlockedPlugins(); |
| 4067 *success = true; |
| 4068 } |
| 4069 } |
| 4070 |
4055 void TestingAutomationProvider::ResetToDefaultTheme() { | 4071 void TestingAutomationProvider::ResetToDefaultTheme() { |
4056 profile_->ClearTheme(); | 4072 profile_->ClearTheme(); |
4057 } | 4073 } |
4058 | 4074 |
4059 // TODO(brettw) change this to accept GURLs when history supports it | 4075 // TODO(brettw) change this to accept GURLs when history supports it |
4060 void TestingAutomationProvider::OnRedirectQueryComplete( | 4076 void TestingAutomationProvider::OnRedirectQueryComplete( |
4061 HistoryService::Handle request_handle, | 4077 HistoryService::Handle request_handle, |
4062 GURL from_url, | 4078 GURL from_url, |
4063 bool success, | 4079 bool success, |
4064 history::RedirectList* redirects) { | 4080 history::RedirectList* redirects) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4101 DCHECK(type == NotificationType::SESSION_END); | 4117 DCHECK(type == NotificationType::SESSION_END); |
4102 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit | 4118 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit |
4103 // before the task runs resulting in this object not being deleted. This | 4119 // before the task runs resulting in this object not being deleted. This |
4104 // Release balance out the Release scheduled by OnBrowserRemoved. | 4120 // Release balance out the Release scheduled by OnBrowserRemoved. |
4105 Release(); | 4121 Release(); |
4106 } | 4122 } |
4107 | 4123 |
4108 void TestingAutomationProvider::OnRemoveProvider() { | 4124 void TestingAutomationProvider::OnRemoveProvider() { |
4109 AutomationProviderList::GetInstance()->RemoveProvider(this); | 4125 AutomationProviderList::GetInstance()->RemoveProvider(this); |
4110 } | 4126 } |
OLD | NEW |