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 2980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2991 this, reply_message, false)); | 2991 this, reply_message, false)); |
2992 selected_item->DangerousDownloadValidated(); | 2992 selected_item->DangerousDownloadValidated(); |
2993 } else if (action == "toggle_pause") { | 2993 } else if (action == "toggle_pause") { |
2994 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( | 2994 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( |
2995 this, reply_message, false)); | 2995 this, reply_message, false)); |
2996 // This will still return if download has already completed. | 2996 // This will still return if download has already completed. |
2997 selected_item->TogglePause(); | 2997 selected_item->TogglePause(); |
2998 } else if (action == "cancel") { | 2998 } else if (action == "cancel") { |
2999 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( | 2999 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( |
3000 this, reply_message, false)); | 3000 this, reply_message, false)); |
3001 selected_item->Cancel(true); | 3001 selected_item->Cancel(); |
3002 } else { | 3002 } else { |
3003 AutomationJSONReply(this, reply_message) | 3003 AutomationJSONReply(this, reply_message) |
3004 .SendError(StringPrintf("Invalid action '%s' given.", action.c_str())); | 3004 .SendError(StringPrintf("Invalid action '%s' given.", action.c_str())); |
3005 } | 3005 } |
3006 } | 3006 } |
3007 | 3007 |
3008 // Sample JSON input { "command": "LoadSearchEngineInfo" } | 3008 // Sample JSON input { "command": "LoadSearchEngineInfo" } |
3009 void TestingAutomationProvider::LoadSearchEngineInfo( | 3009 void TestingAutomationProvider::LoadSearchEngineInfo( |
3010 Browser* browser, | 3010 Browser* browser, |
3011 DictionaryValue* args, | 3011 DictionaryValue* args, |
(...skipping 3040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6052 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); | 6052 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); |
6053 | 6053 |
6054 Send(reply_message_); | 6054 Send(reply_message_); |
6055 redirect_query_ = 0; | 6055 redirect_query_ = 0; |
6056 reply_message_ = NULL; | 6056 reply_message_ = NULL; |
6057 } | 6057 } |
6058 | 6058 |
6059 void TestingAutomationProvider::OnRemoveProvider() { | 6059 void TestingAutomationProvider::OnRemoveProvider() { |
6060 AutomationProviderList::GetInstance()->RemoveProvider(this); | 6060 AutomationProviderList::GetInstance()->RemoveProvider(this); |
6061 } | 6061 } |
OLD | NEW |