diff options
author | alyssad@google.com <alyssad@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-20 00:42:28 +0000 |
---|---|---|
committer | alyssad@google.com <alyssad@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-20 00:42:28 +0000 |
commit | 2d54c403539416779245fb684789f2f68ec9fb61 (patch) | |
tree | 5cc52f9323d100925d04c9e6ced5ec9ee5df7494 /chrome/browser/automation/automation_provider_observers.cc | |
parent | 0eb8aa7a9651c8303f9911a3d7a50dd02df99660 (diff) | |
download | chromium_src-2d54c403539416779245fb684789f2f68ec9fb61.zip chromium_src-2d54c403539416779245fb684789f2f68ec9fb61.tar.gz chromium_src-2d54c403539416779245fb684789f2f68ec9fb61.tar.bz2 |
New downloads hooks for pyauto. BUG=35284
New hooks allow the user to pause/resume/cancel/remove downloads and more.
Review URL: http://codereview.chromium.org/3176016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56789 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/automation_provider_observers.cc')
-rw-r--r-- | chrome/browser/automation/automation_provider_observers.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index 4938867..badfb4d 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -1064,6 +1064,37 @@ void AutomationProviderDownloadItemObserver::OnDownloadFileCompleted( } } +void AutomationProviderDownloadUpdatedObserver::OnDownloadUpdated( + DownloadItem* download) { + // If this observer is watching for open, only send the reply if the download + // has been auto-opened. + if (wait_for_open_ && !download->auto_opened()) + return; + + download->RemoveObserver(this); + scoped_ptr<DictionaryValue> return_value( + provider_->GetDictionaryFromDownloadItem(download)); + AutomationJSONReply(provider_, reply_message_).SendSuccess( + return_value.get()); + delete this; +} + +void AutomationProviderDownloadUpdatedObserver::OnDownloadOpened( + DownloadItem* download) { + download->RemoveObserver(this); + scoped_ptr<DictionaryValue> return_value( + provider_->GetDictionaryFromDownloadItem(download)); + AutomationJSONReply(provider_, reply_message_).SendSuccess( + return_value.get()); + delete this; +} + +void AutomationProviderDownloadModelChangedObserver::ModelChanged() { + AutomationJSONReply(provider_, reply_message_).SendSuccess(NULL); + download_manager_->RemoveObserver(this); + delete this; +} + void AutomationProviderHistoryObserver::HistoryQueryComplete( HistoryService::Handle request_handle, history::QueryResults* results) { |