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 2913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2924 this, reply_message, false)); | 2924 this, reply_message, false)); |
2925 selected_item->DangerousDownloadValidated(); | 2925 selected_item->DangerousDownloadValidated(); |
2926 } else if (action == "toggle_pause") { | 2926 } else if (action == "toggle_pause") { |
2927 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( | 2927 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( |
2928 this, reply_message, false)); | 2928 this, reply_message, false)); |
2929 // This will still return if download has already completed. | 2929 // This will still return if download has already completed. |
2930 selected_item->TogglePause(); | 2930 selected_item->TogglePause(); |
2931 } else if (action == "cancel") { | 2931 } else if (action == "cancel") { |
2932 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( | 2932 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( |
2933 this, reply_message, false)); | 2933 this, reply_message, false)); |
2934 selected_item->Cancel(true); | 2934 selected_item->Cancel(); |
2935 } else { | 2935 } else { |
2936 AutomationJSONReply(this, reply_message) | 2936 AutomationJSONReply(this, reply_message) |
2937 .SendError(StringPrintf("Invalid action '%s' given.", action.c_str())); | 2937 .SendError(StringPrintf("Invalid action '%s' given.", action.c_str())); |
2938 } | 2938 } |
2939 } | 2939 } |
2940 | 2940 |
2941 // Sample JSON input { "command": "LoadSearchEngineInfo" } | 2941 // Sample JSON input { "command": "LoadSearchEngineInfo" } |
2942 void TestingAutomationProvider::LoadSearchEngineInfo( | 2942 void TestingAutomationProvider::LoadSearchEngineInfo( |
2943 Browser* browser, | 2943 Browser* browser, |
2944 DictionaryValue* args, | 2944 DictionaryValue* args, |
(...skipping 2965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5910 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); | 5910 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); |
5911 | 5911 |
5912 Send(reply_message_); | 5912 Send(reply_message_); |
5913 redirect_query_ = 0; | 5913 redirect_query_ = 0; |
5914 reply_message_ = NULL; | 5914 reply_message_ = NULL; |
5915 } | 5915 } |
5916 | 5916 |
5917 void TestingAutomationProvider::OnRemoveProvider() { | 5917 void TestingAutomationProvider::OnRemoveProvider() { |
5918 AutomationProviderList::GetInstance()->RemoveProvider(this); | 5918 AutomationProviderList::GetInstance()->RemoveProvider(this); |
5919 } | 5919 } |
OLD | NEW |