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 3158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3169 return; | 3169 return; |
3170 } | 3170 } |
3171 | 3171 |
3172 if (action == "open") { | 3172 if (action == "open") { |
3173 selected_item->AddObserver( | 3173 selected_item->AddObserver( |
3174 new AutomationProviderDownloadUpdatedObserver( | 3174 new AutomationProviderDownloadUpdatedObserver( |
3175 this, reply_message, true)); | 3175 this, reply_message, true)); |
3176 selected_item->OpenDownload(); | 3176 selected_item->OpenDownload(); |
3177 } else if (action == "toggle_open_files_like_this") { | 3177 } else if (action == "toggle_open_files_like_this") { |
3178 DownloadPrefs* prefs = | 3178 DownloadPrefs* prefs = |
3179 DownloadPrefs::FromDownloadManager(selected_item->GetDownloadManager()); | 3179 DownloadPrefs::FromBrowserContext(selected_item->BrowserContext()); |
3180 FilePath path = selected_item->GetUserVerifiedFilePath(); | 3180 FilePath path = selected_item->GetUserVerifiedFilePath(); |
3181 if (!selected_item->ShouldOpenFileBasedOnExtension()) | 3181 if (!selected_item->ShouldOpenFileBasedOnExtension()) |
3182 prefs->EnableAutoOpenBasedOnExtension(path); | 3182 prefs->EnableAutoOpenBasedOnExtension(path); |
3183 else | 3183 else |
3184 prefs->DisableAutoOpenBasedOnExtension(path); | 3184 prefs->DisableAutoOpenBasedOnExtension(path); |
3185 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 3185 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
3186 } else if (action == "remove") { | 3186 } else if (action == "remove") { |
3187 download_manager->AddObserver( | 3187 download_manager->AddObserver( |
3188 new AutomationProviderDownloadModelChangedObserver( | 3188 new AutomationProviderDownloadModelChangedObserver( |
3189 this, reply_message, download_manager)); | 3189 this, reply_message, download_manager)); |
(...skipping 3456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6646 | 6646 |
6647 Send(reply_message_); | 6647 Send(reply_message_); |
6648 redirect_query_ = 0; | 6648 redirect_query_ = 0; |
6649 reply_message_ = NULL; | 6649 reply_message_ = NULL; |
6650 } | 6650 } |
6651 | 6651 |
6652 void TestingAutomationProvider::OnRemoveProvider() { | 6652 void TestingAutomationProvider::OnRemoveProvider() { |
6653 if (g_browser_process) | 6653 if (g_browser_process) |
6654 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6654 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6655 } | 6655 } |
OLD | NEW |