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 2974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2985 this, reply_message, false)); | 2985 this, reply_message, false)); |
2986 selected_item->DangerousDownloadValidated(); | 2986 selected_item->DangerousDownloadValidated(); |
2987 } else if (action == "toggle_pause") { | 2987 } else if (action == "toggle_pause") { |
2988 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( | 2988 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( |
2989 this, reply_message, false)); | 2989 this, reply_message, false)); |
2990 // This will still return if download has already completed. | 2990 // This will still return if download has already completed. |
2991 selected_item->TogglePause(); | 2991 selected_item->TogglePause(); |
2992 } else if (action == "cancel") { | 2992 } else if (action == "cancel") { |
2993 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( | 2993 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( |
2994 this, reply_message, false)); | 2994 this, reply_message, false)); |
2995 selected_item->Cancel(true); | 2995 selected_item->Cancel(); |
2996 } else { | 2996 } else { |
2997 AutomationJSONReply(this, reply_message) | 2997 AutomationJSONReply(this, reply_message) |
2998 .SendError(StringPrintf("Invalid action '%s' given.", action.c_str())); | 2998 .SendError(StringPrintf("Invalid action '%s' given.", action.c_str())); |
2999 } | 2999 } |
3000 } | 3000 } |
3001 | 3001 |
3002 // Sample JSON input { "command": "LoadSearchEngineInfo" } | 3002 // Sample JSON input { "command": "LoadSearchEngineInfo" } |
3003 void TestingAutomationProvider::LoadSearchEngineInfo( | 3003 void TestingAutomationProvider::LoadSearchEngineInfo( |
3004 Browser* browser, | 3004 Browser* browser, |
3005 DictionaryValue* args, | 3005 DictionaryValue* args, |
(...skipping 3039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6045 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); | 6045 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); |
6046 | 6046 |
6047 Send(reply_message_); | 6047 Send(reply_message_); |
6048 redirect_query_ = 0; | 6048 redirect_query_ = 0; |
6049 reply_message_ = NULL; | 6049 reply_message_ = NULL; |
6050 } | 6050 } |
6051 | 6051 |
6052 void TestingAutomationProvider::OnRemoveProvider() { | 6052 void TestingAutomationProvider::OnRemoveProvider() { |
6053 AutomationProviderList::GetInstance()->RemoveProvider(this); | 6053 AutomationProviderList::GetInstance()->RemoveProvider(this); |
6054 } | 6054 } |
OLD | NEW |