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 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3104 this, reply_message, false)); | 3104 this, reply_message, false)); |
3105 selected_item->DangerousDownloadValidated(); | 3105 selected_item->DangerousDownloadValidated(); |
3106 } else if (action == "toggle_pause") { | 3106 } else if (action == "toggle_pause") { |
3107 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( | 3107 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( |
3108 this, reply_message, false)); | 3108 this, reply_message, false)); |
3109 // This will still return if download has already completed. | 3109 // This will still return if download has already completed. |
3110 selected_item->TogglePause(); | 3110 selected_item->TogglePause(); |
3111 } else if (action == "cancel") { | 3111 } else if (action == "cancel") { |
3112 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( | 3112 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( |
3113 this, reply_message, false)); | 3113 this, reply_message, false)); |
3114 selected_item->Cancel(true); | 3114 selected_item->Cancel(); |
3115 } else { | 3115 } else { |
3116 AutomationJSONReply(this, reply_message) | 3116 AutomationJSONReply(this, reply_message) |
3117 .SendError(StringPrintf("Invalid action '%s' given.", action.c_str())); | 3117 .SendError(StringPrintf("Invalid action '%s' given.", action.c_str())); |
3118 } | 3118 } |
3119 } | 3119 } |
3120 | 3120 |
3121 // Sample JSON input { "command": "LoadSearchEngineInfo" } | 3121 // Sample JSON input { "command": "LoadSearchEngineInfo" } |
3122 void TestingAutomationProvider::LoadSearchEngineInfo( | 3122 void TestingAutomationProvider::LoadSearchEngineInfo( |
3123 Browser* browser, | 3123 Browser* browser, |
3124 DictionaryValue* args, | 3124 DictionaryValue* args, |
(...skipping 3213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6338 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); | 6338 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); |
6339 | 6339 |
6340 Send(reply_message_); | 6340 Send(reply_message_); |
6341 redirect_query_ = 0; | 6341 redirect_query_ = 0; |
6342 reply_message_ = NULL; | 6342 reply_message_ = NULL; |
6343 } | 6343 } |
6344 | 6344 |
6345 void TestingAutomationProvider::OnRemoveProvider() { | 6345 void TestingAutomationProvider::OnRemoveProvider() { |
6346 AutomationProviderList::GetInstance()->RemoveProvider(this); | 6346 AutomationProviderList::GetInstance()->RemoveProvider(this); |
6347 } | 6347 } |
OLD | NEW |