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 3109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3120 this, reply_message, false)); | 3120 this, reply_message, false)); |
3121 selected_item->DangerousDownloadValidated(); | 3121 selected_item->DangerousDownloadValidated(); |
3122 } else if (action == "toggle_pause") { | 3122 } else if (action == "toggle_pause") { |
3123 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( | 3123 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( |
3124 this, reply_message, false)); | 3124 this, reply_message, false)); |
3125 // This will still return if download has already completed. | 3125 // This will still return if download has already completed. |
3126 selected_item->TogglePause(); | 3126 selected_item->TogglePause(); |
3127 } else if (action == "cancel") { | 3127 } else if (action == "cancel") { |
3128 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( | 3128 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( |
3129 this, reply_message, false)); | 3129 this, reply_message, false)); |
3130 selected_item->Cancel(true); | 3130 selected_item->Cancel(); |
3131 } else { | 3131 } else { |
3132 AutomationJSONReply(this, reply_message) | 3132 AutomationJSONReply(this, reply_message) |
3133 .SendError(StringPrintf("Invalid action '%s' given.", action.c_str())); | 3133 .SendError(StringPrintf("Invalid action '%s' given.", action.c_str())); |
3134 } | 3134 } |
3135 } | 3135 } |
3136 | 3136 |
3137 // Sample JSON input { "command": "LoadSearchEngineInfo" } | 3137 // Sample JSON input { "command": "LoadSearchEngineInfo" } |
3138 void TestingAutomationProvider::LoadSearchEngineInfo( | 3138 void TestingAutomationProvider::LoadSearchEngineInfo( |
3139 Browser* browser, | 3139 Browser* browser, |
3140 DictionaryValue* args, | 3140 DictionaryValue* args, |
(...skipping 3206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6347 | 6347 |
6348 Send(reply_message_); | 6348 Send(reply_message_); |
6349 redirect_query_ = 0; | 6349 redirect_query_ = 0; |
6350 reply_message_ = NULL; | 6350 reply_message_ = NULL; |
6351 } | 6351 } |
6352 | 6352 |
6353 void TestingAutomationProvider::OnRemoveProvider() { | 6353 void TestingAutomationProvider::OnRemoveProvider() { |
6354 if (g_browser_process) | 6354 if (g_browser_process) |
6355 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6355 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6356 } | 6356 } |
OLD | NEW |