| 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" |
| 81 #include "chrome/browser/ui/browser_window.h" | 82 #include "chrome/browser/ui/browser_window.h" |
| 82 #include "chrome/browser/ui/find_bar/find_bar.h" | 83 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 83 #include "chrome/browser/ui/login/login_prompt.h" | 84 #include "chrome/browser/ui/login/login_prompt.h" |
| 84 #include "chrome/browser/ui/omnibox/location_bar.h" | 85 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 85 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 86 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 86 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" | 87 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" |
| 87 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 88 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 88 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" | 89 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" |
| 89 #include "chrome/common/automation_messages.h" | 90 #include "chrome/common/automation_messages.h" |
| 90 #include "chrome/common/chrome_constants.h" | 91 #include "chrome/common/chrome_constants.h" |
| (...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2206 handler_map["ActivateTab"] = | 2207 handler_map["ActivateTab"] = |
| 2207 &TestingAutomationProvider::ActivateTabJSON; | 2208 &TestingAutomationProvider::ActivateTabJSON; |
| 2208 handler_map["GetAppModalDialogMessage"] = | 2209 handler_map["GetAppModalDialogMessage"] = |
| 2209 &TestingAutomationProvider::GetAppModalDialogMessage; | 2210 &TestingAutomationProvider::GetAppModalDialogMessage; |
| 2210 handler_map["AcceptOrDismissAppModalDialog"] = | 2211 handler_map["AcceptOrDismissAppModalDialog"] = |
| 2211 &TestingAutomationProvider::AcceptOrDismissAppModalDialog; | 2212 &TestingAutomationProvider::AcceptOrDismissAppModalDialog; |
| 2212 handler_map["GetChromeDriverAutomationVersion"] = | 2213 handler_map["GetChromeDriverAutomationVersion"] = |
| 2213 &TestingAutomationProvider::GetChromeDriverAutomationVersion; | 2214 &TestingAutomationProvider::GetChromeDriverAutomationVersion; |
| 2214 handler_map["UpdateExtensionsNow"] = | 2215 handler_map["UpdateExtensionsNow"] = |
| 2215 &TestingAutomationProvider::UpdateExtensionsNow; | 2216 &TestingAutomationProvider::UpdateExtensionsNow; |
| 2217 handler_map["CreateNewAutomationProvider"] = |
| 2218 &TestingAutomationProvider::CreateNewAutomationProvider; |
| 2216 #if defined(OS_CHROMEOS) | 2219 #if defined(OS_CHROMEOS) |
| 2217 handler_map["GetLoginInfo"] = &TestingAutomationProvider::GetLoginInfo; | 2220 handler_map["GetLoginInfo"] = &TestingAutomationProvider::GetLoginInfo; |
| 2218 handler_map["ShowCreateAccountUI"] = | 2221 handler_map["ShowCreateAccountUI"] = |
| 2219 &TestingAutomationProvider::ShowCreateAccountUI; | 2222 &TestingAutomationProvider::ShowCreateAccountUI; |
| 2220 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest; | 2223 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest; |
| 2221 handler_map["Login"] = &TestingAutomationProvider::Login; | 2224 handler_map["Login"] = &TestingAutomationProvider::Login; |
| 2222 | 2225 |
| 2223 handler_map["LockScreen"] = &TestingAutomationProvider::LockScreen; | 2226 handler_map["LockScreen"] = &TestingAutomationProvider::LockScreen; |
| 2224 handler_map["UnlockScreen"] = &TestingAutomationProvider::UnlockScreen; | 2227 handler_map["UnlockScreen"] = &TestingAutomationProvider::UnlockScreen; |
| 2225 handler_map["SignoutInScreenLocker"] = | 2228 handler_map["SignoutInScreenLocker"] = |
| (...skipping 3760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5986 } | 5989 } |
| 5987 | 5990 |
| 5988 void TestingAutomationProvider::GetChromeDriverAutomationVersion( | 5991 void TestingAutomationProvider::GetChromeDriverAutomationVersion( |
| 5989 DictionaryValue* args, | 5992 DictionaryValue* args, |
| 5990 IPC::Message* reply_message) { | 5993 IPC::Message* reply_message) { |
| 5991 DictionaryValue reply_dict; | 5994 DictionaryValue reply_dict; |
| 5992 reply_dict.SetInteger("version", automation::kChromeDriverAutomationVersion); | 5995 reply_dict.SetInteger("version", automation::kChromeDriverAutomationVersion); |
| 5993 AutomationJSONReply(this, reply_message).SendSuccess(&reply_dict); | 5996 AutomationJSONReply(this, reply_message).SendSuccess(&reply_dict); |
| 5994 } | 5997 } |
| 5995 | 5998 |
| 5999 void TestingAutomationProvider::CreateNewAutomationProvider( |
| 6000 DictionaryValue* args, |
| 6001 IPC::Message* reply_message) { |
| 6002 AutomationJSONReply reply(this, reply_message); |
| 6003 std::string channel_id; |
| 6004 if (!args->GetString("channel_id", &channel_id)) { |
| 6005 reply.SendError("'channel_id' missing or invalid"); |
| 6006 return; |
| 6007 } |
| 6008 |
| 6009 if (!BrowserInit::CreateAutomationProvider<TestingAutomationProvider>( |
| 6010 automation::kNamedInterfacePrefix + channel_id, profile_, 0)) { |
| 6011 reply.SendError("Failed to initialize channel: " + channel_id); |
| 6012 return; |
| 6013 } |
| 6014 reply.SendSuccess(NULL); |
| 6015 } |
| 6016 |
| 5996 void TestingAutomationProvider::WaitForTabCountToBecome( | 6017 void TestingAutomationProvider::WaitForTabCountToBecome( |
| 5997 int browser_handle, | 6018 int browser_handle, |
| 5998 int target_tab_count, | 6019 int target_tab_count, |
| 5999 IPC::Message* reply_message) { | 6020 IPC::Message* reply_message) { |
| 6000 if (!browser_tracker_->ContainsHandle(browser_handle)) { | 6021 if (!browser_tracker_->ContainsHandle(browser_handle)) { |
| 6001 AutomationMsg_WaitForTabCountToBecome::WriteReplyParams(reply_message, | 6022 AutomationMsg_WaitForTabCountToBecome::WriteReplyParams(reply_message, |
| 6002 false); | 6023 false); |
| 6003 Send(reply_message); | 6024 Send(reply_message); |
| 6004 return; | 6025 return; |
| 6005 } | 6026 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6140 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); | 6161 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); |
| 6141 | 6162 |
| 6142 Send(reply_message_); | 6163 Send(reply_message_); |
| 6143 redirect_query_ = 0; | 6164 redirect_query_ = 0; |
| 6144 reply_message_ = NULL; | 6165 reply_message_ = NULL; |
| 6145 } | 6166 } |
| 6146 | 6167 |
| 6147 void TestingAutomationProvider::OnRemoveProvider() { | 6168 void TestingAutomationProvider::OnRemoveProvider() { |
| 6148 AutomationProviderList::GetInstance()->RemoveProvider(this); | 6169 AutomationProviderList::GetInstance()->RemoveProvider(this); |
| 6149 } | 6170 } |
| OLD | NEW |