| 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 #include "chrome/browser/tab_contents/link_infobar_delegate.h" | 71 #include "chrome/browser/tab_contents/link_infobar_delegate.h" |
| 72 #include "chrome/browser/themes/theme_service.h" | 72 #include "chrome/browser/themes/theme_service.h" |
| 73 #include "chrome/browser/themes/theme_service_factory.h" | 73 #include "chrome/browser/themes/theme_service_factory.h" |
| 74 #include "chrome/browser/translate/translate_infobar_delegate.h" | 74 #include "chrome/browser/translate/translate_infobar_delegate.h" |
| 75 #include "chrome/browser/translate/translate_tab_helper.h" | 75 #include "chrome/browser/translate/translate_tab_helper.h" |
| 76 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 76 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
| 77 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 77 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
| 78 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" | 78 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" |
| 79 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" | 79 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
| 80 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 80 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 81 #include "chrome/browser/ui/browser_init.h" | |
| 82 #include "chrome/browser/ui/browser_window.h" | 81 #include "chrome/browser/ui/browser_window.h" |
| 83 #include "chrome/browser/ui/find_bar/find_bar.h" | 82 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 84 #include "chrome/browser/ui/login/login_prompt.h" | 83 #include "chrome/browser/ui/login/login_prompt.h" |
| 85 #include "chrome/browser/ui/omnibox/location_bar.h" | 84 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 86 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 85 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 87 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" | 86 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" |
| 88 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 87 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 89 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" | 88 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" |
| 90 #include "chrome/common/automation_messages.h" | 89 #include "chrome/common/automation_messages.h" |
| 91 #include "chrome/common/chrome_constants.h" | 90 #include "chrome/common/chrome_constants.h" |
| (...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2207 handler_map["ActivateTab"] = | 2206 handler_map["ActivateTab"] = |
| 2208 &TestingAutomationProvider::ActivateTabJSON; | 2207 &TestingAutomationProvider::ActivateTabJSON; |
| 2209 handler_map["GetAppModalDialogMessage"] = | 2208 handler_map["GetAppModalDialogMessage"] = |
| 2210 &TestingAutomationProvider::GetAppModalDialogMessage; | 2209 &TestingAutomationProvider::GetAppModalDialogMessage; |
| 2211 handler_map["AcceptOrDismissAppModalDialog"] = | 2210 handler_map["AcceptOrDismissAppModalDialog"] = |
| 2212 &TestingAutomationProvider::AcceptOrDismissAppModalDialog; | 2211 &TestingAutomationProvider::AcceptOrDismissAppModalDialog; |
| 2213 handler_map["GetChromeDriverAutomationVersion"] = | 2212 handler_map["GetChromeDriverAutomationVersion"] = |
| 2214 &TestingAutomationProvider::GetChromeDriverAutomationVersion; | 2213 &TestingAutomationProvider::GetChromeDriverAutomationVersion; |
| 2215 handler_map["UpdateExtensionsNow"] = | 2214 handler_map["UpdateExtensionsNow"] = |
| 2216 &TestingAutomationProvider::UpdateExtensionsNow; | 2215 &TestingAutomationProvider::UpdateExtensionsNow; |
| 2217 handler_map["CreateNewAutomationProvider"] = | |
| 2218 &TestingAutomationProvider::CreateNewAutomationProvider; | |
| 2219 #if defined(OS_CHROMEOS) | 2216 #if defined(OS_CHROMEOS) |
| 2220 handler_map["GetLoginInfo"] = &TestingAutomationProvider::GetLoginInfo; | 2217 handler_map["GetLoginInfo"] = &TestingAutomationProvider::GetLoginInfo; |
| 2221 handler_map["ShowCreateAccountUI"] = | 2218 handler_map["ShowCreateAccountUI"] = |
| 2222 &TestingAutomationProvider::ShowCreateAccountUI; | 2219 &TestingAutomationProvider::ShowCreateAccountUI; |
| 2223 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest; | 2220 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest; |
| 2224 handler_map["Login"] = &TestingAutomationProvider::Login; | 2221 handler_map["Login"] = &TestingAutomationProvider::Login; |
| 2225 | 2222 |
| 2226 handler_map["LockScreen"] = &TestingAutomationProvider::LockScreen; | 2223 handler_map["LockScreen"] = &TestingAutomationProvider::LockScreen; |
| 2227 handler_map["UnlockScreen"] = &TestingAutomationProvider::UnlockScreen; | 2224 handler_map["UnlockScreen"] = &TestingAutomationProvider::UnlockScreen; |
| 2228 handler_map["SignoutInScreenLocker"] = | 2225 handler_map["SignoutInScreenLocker"] = |
| (...skipping 3773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6002 } | 5999 } |
| 6003 | 6000 |
| 6004 void TestingAutomationProvider::GetChromeDriverAutomationVersion( | 6001 void TestingAutomationProvider::GetChromeDriverAutomationVersion( |
| 6005 DictionaryValue* args, | 6002 DictionaryValue* args, |
| 6006 IPC::Message* reply_message) { | 6003 IPC::Message* reply_message) { |
| 6007 DictionaryValue reply_dict; | 6004 DictionaryValue reply_dict; |
| 6008 reply_dict.SetInteger("version", automation::kChromeDriverAutomationVersion); | 6005 reply_dict.SetInteger("version", automation::kChromeDriverAutomationVersion); |
| 6009 AutomationJSONReply(this, reply_message).SendSuccess(&reply_dict); | 6006 AutomationJSONReply(this, reply_message).SendSuccess(&reply_dict); |
| 6010 } | 6007 } |
| 6011 | 6008 |
| 6012 void TestingAutomationProvider::CreateNewAutomationProvider( | |
| 6013 DictionaryValue* args, | |
| 6014 IPC::Message* reply_message) { | |
| 6015 AutomationJSONReply reply(this, reply_message); | |
| 6016 std::string channel_id; | |
| 6017 if (!args->GetString("channel_id", &channel_id)) { | |
| 6018 reply.SendError("'channel_id' missing or invalid"); | |
| 6019 return; | |
| 6020 } | |
| 6021 | |
| 6022 // TODO(kkania): Remove this when crbug.com/91311 is fixed. | |
| 6023 // Named server channels should ideally be created and closed on the file | |
| 6024 // thread, within the IPC channel code. | |
| 6025 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
| 6026 if (!BrowserInit::CreateAutomationProvider<TestingAutomationProvider>( | |
| 6027 automation::kNamedInterfacePrefix + channel_id, profile_, 0)) { | |
| 6028 reply.SendError("Failed to initialize channel: " + channel_id); | |
| 6029 return; | |
| 6030 } | |
| 6031 reply.SendSuccess(NULL); | |
| 6032 } | |
| 6033 | |
| 6034 void TestingAutomationProvider::WaitForTabCountToBecome( | 6009 void TestingAutomationProvider::WaitForTabCountToBecome( |
| 6035 int browser_handle, | 6010 int browser_handle, |
| 6036 int target_tab_count, | 6011 int target_tab_count, |
| 6037 IPC::Message* reply_message) { | 6012 IPC::Message* reply_message) { |
| 6038 if (!browser_tracker_->ContainsHandle(browser_handle)) { | 6013 if (!browser_tracker_->ContainsHandle(browser_handle)) { |
| 6039 AutomationMsg_WaitForTabCountToBecome::WriteReplyParams(reply_message, | 6014 AutomationMsg_WaitForTabCountToBecome::WriteReplyParams(reply_message, |
| 6040 false); | 6015 false); |
| 6041 Send(reply_message); | 6016 Send(reply_message); |
| 6042 return; | 6017 return; |
| 6043 } | 6018 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6178 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); | 6153 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); |
| 6179 | 6154 |
| 6180 Send(reply_message_); | 6155 Send(reply_message_); |
| 6181 redirect_query_ = 0; | 6156 redirect_query_ = 0; |
| 6182 reply_message_ = NULL; | 6157 reply_message_ = NULL; |
| 6183 } | 6158 } |
| 6184 | 6159 |
| 6185 void TestingAutomationProvider::OnRemoveProvider() { | 6160 void TestingAutomationProvider::OnRemoveProvider() { |
| 6186 AutomationProviderList::GetInstance()->RemoveProvider(this); | 6161 AutomationProviderList::GetInstance()->RemoveProvider(this); |
| 6187 } | 6162 } |
| OLD | NEW |