| 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 3145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3156 return; | 3156 return; |
| 3157 } | 3157 } |
| 3158 | 3158 |
| 3159 if (action == "open") { | 3159 if (action == "open") { |
| 3160 selected_item->AddObserver( | 3160 selected_item->AddObserver( |
| 3161 new AutomationProviderDownloadUpdatedObserver( | 3161 new AutomationProviderDownloadUpdatedObserver( |
| 3162 this, reply_message, true)); | 3162 this, reply_message, true)); |
| 3163 selected_item->OpenDownload(); | 3163 selected_item->OpenDownload(); |
| 3164 } else if (action == "toggle_open_files_like_this") { | 3164 } else if (action == "toggle_open_files_like_this") { |
| 3165 DownloadPrefs* prefs = | 3165 DownloadPrefs* prefs = |
| 3166 DownloadPrefs::FromDownloadManager(selected_item->GetDownloadManager()); | 3166 DownloadPrefs::FromBrowserContext(selected_item->BrowserContext()); |
| 3167 FilePath path = selected_item->GetUserVerifiedFilePath(); | 3167 FilePath path = selected_item->GetUserVerifiedFilePath(); |
| 3168 if (!selected_item->ShouldOpenFileBasedOnExtension()) | 3168 if (!selected_item->ShouldOpenFileBasedOnExtension()) |
| 3169 prefs->EnableAutoOpenBasedOnExtension(path); | 3169 prefs->EnableAutoOpenBasedOnExtension(path); |
| 3170 else | 3170 else |
| 3171 prefs->DisableAutoOpenBasedOnExtension(path); | 3171 prefs->DisableAutoOpenBasedOnExtension(path); |
| 3172 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 3172 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
| 3173 } else if (action == "remove") { | 3173 } else if (action == "remove") { |
| 3174 download_manager->AddObserver( | 3174 download_manager->AddObserver( |
| 3175 new AutomationProviderDownloadModelChangedObserver( | 3175 new AutomationProviderDownloadModelChangedObserver( |
| 3176 this, reply_message, download_manager)); | 3176 this, reply_message, download_manager)); |
| (...skipping 3201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6378 | 6378 |
| 6379 Send(reply_message_); | 6379 Send(reply_message_); |
| 6380 redirect_query_ = 0; | 6380 redirect_query_ = 0; |
| 6381 reply_message_ = NULL; | 6381 reply_message_ = NULL; |
| 6382 } | 6382 } |
| 6383 | 6383 |
| 6384 void TestingAutomationProvider::OnRemoveProvider() { | 6384 void TestingAutomationProvider::OnRemoveProvider() { |
| 6385 if (g_browser_process) | 6385 if (g_browser_process) |
| 6386 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6386 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 6387 } | 6387 } |
| OLD | NEW |