OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 2638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2649 else | 2649 else |
2650 prefs->DisableAutoOpenBasedOnExtension(path); | 2650 prefs->DisableAutoOpenBasedOnExtension(path); |
2651 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 2651 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
2652 } else if (action == "remove") { | 2652 } else if (action == "remove") { |
2653 new AutomationProviderDownloadModelChangedObserver( | 2653 new AutomationProviderDownloadModelChangedObserver( |
2654 this, reply_message, download_manager); | 2654 this, reply_message, download_manager); |
2655 selected_item->Remove(); | 2655 selected_item->Remove(); |
2656 } else if (action == "decline_dangerous_download") { | 2656 } else if (action == "decline_dangerous_download") { |
2657 new AutomationProviderDownloadModelChangedObserver( | 2657 new AutomationProviderDownloadModelChangedObserver( |
2658 this, reply_message, download_manager); | 2658 this, reply_message, download_manager); |
2659 selected_item->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | 2659 selected_item->Remove(); |
2660 } else if (action == "save_dangerous_download") { | 2660 } else if (action == "save_dangerous_download") { |
2661 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( | 2661 selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver( |
2662 this, reply_message, false, browser->profile()->IsOffTheRecord())); | 2662 this, reply_message, false, browser->profile()->IsOffTheRecord())); |
2663 selected_item->DangerousDownloadValidated(); | 2663 selected_item->ValidateDangerousDownload(); |
2664 } else if (action == "pause") { | 2664 } else if (action == "pause") { |
2665 if (!selected_item->IsInProgress() || selected_item->IsPaused()) { | 2665 if (!selected_item->IsInProgress() || selected_item->IsPaused()) { |
2666 // Action would be a no-op; respond right from here. No-op implies | 2666 // Action would be a no-op; respond right from here. No-op implies |
2667 // the test is poorly written or failing, so make it an error return. | 2667 // the test is poorly written or failing, so make it an error return. |
2668 if (!selected_item->IsInProgress()) { | 2668 if (!selected_item->IsInProgress()) { |
2669 AutomationJSONReply(this, reply_message) | 2669 AutomationJSONReply(this, reply_message) |
2670 .SendError("Action 'pause' called on download in termal state."); | 2670 .SendError("Action 'pause' called on download in termal state."); |
2671 } else { | 2671 } else { |
2672 AutomationJSONReply(this, reply_message) | 2672 AutomationJSONReply(this, reply_message) |
2673 .SendError("Action 'pause' called on already paused download."); | 2673 .SendError("Action 'pause' called on already paused download."); |
(...skipping 3270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5944 if (g_browser_process) | 5944 if (g_browser_process) |
5945 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 5945 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
5946 } | 5946 } |
5947 | 5947 |
5948 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 5948 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
5949 WebContents* tab) { | 5949 WebContents* tab) { |
5950 TabStripModel* tab_strip = browser->tab_strip_model(); | 5950 TabStripModel* tab_strip = browser->tab_strip_model(); |
5951 if (tab_strip->GetActiveWebContents() != tab) | 5951 if (tab_strip->GetActiveWebContents() != tab) |
5952 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 5952 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
5953 } | 5953 } |
OLD | NEW |