| 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 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2636 } | 2636 } |
| 2637 | 2637 |
| 2638 if (action == "open") { | 2638 if (action == "open") { |
| 2639 selected_item->AddObserver( | 2639 selected_item->AddObserver( |
| 2640 new AutomationProviderDownloadUpdatedObserver( | 2640 new AutomationProviderDownloadUpdatedObserver( |
| 2641 this, reply_message, true, browser->profile()->IsOffTheRecord())); | 2641 this, reply_message, true, browser->profile()->IsOffTheRecord())); |
| 2642 selected_item->OpenDownload(); | 2642 selected_item->OpenDownload(); |
| 2643 } else if (action == "toggle_open_files_like_this") { | 2643 } else if (action == "toggle_open_files_like_this") { |
| 2644 DownloadPrefs* prefs = | 2644 DownloadPrefs* prefs = |
| 2645 DownloadPrefs::FromBrowserContext(selected_item->GetBrowserContext()); | 2645 DownloadPrefs::FromBrowserContext(selected_item->GetBrowserContext()); |
| 2646 base::FilePath path = selected_item->GetUserVerifiedFilePath(); | 2646 base::FilePath path = selected_item->GetTargetFilePath(); |
| 2647 if (!selected_item->ShouldOpenFileBasedOnExtension()) | 2647 if (!selected_item->ShouldOpenFileBasedOnExtension()) |
| 2648 prefs->EnableAutoOpenBasedOnExtension(path); | 2648 prefs->EnableAutoOpenBasedOnExtension(path); |
| 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") { |
| (...skipping 3287 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 |