Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: chrome/browser/automation/automation_provider_observers.h

Issue 3127008: Preliminary work on resuming downloads whose connections have expired.
Patch Set: Waiting to send download automation error message until after other downloads are canceled. Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_
6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <map> 10 #include <map>
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 656
657 DISALLOW_COPY_AND_ASSIGN(AutomationProviderBookmarkModelObserver); 657 DISALLOW_COPY_AND_ASSIGN(AutomationProviderBookmarkModelObserver);
658 }; 658 };
659 659
660 // Allows the automation provider to wait for all downloads to finish. 660 // Allows the automation provider to wait for all downloads to finish.
661 class AutomationProviderDownloadItemObserver : public DownloadItem::Observer { 661 class AutomationProviderDownloadItemObserver : public DownloadItem::Observer {
662 public: 662 public:
663 AutomationProviderDownloadItemObserver( 663 AutomationProviderDownloadItemObserver(
664 AutomationProvider* provider, 664 AutomationProvider* provider,
665 IPC::Message* reply_message, 665 IPC::Message* reply_message,
666 int downloads) { 666 int downloads)
667 provider_ = provider; 667 : provider_(provider),
668 reply_message_ = reply_message; 668 reply_message_(reply_message),
669 downloads_ = downloads; 669 downloads_(downloads),
670 interrupted_(false) {
670 } 671 }
671 virtual ~AutomationProviderDownloadItemObserver() {} 672 virtual ~AutomationProviderDownloadItemObserver() {}
672 673
673 virtual void OnDownloadUpdated(DownloadItem* download) { } 674 virtual void OnDownloadUpdated(DownloadItem* download);
674 virtual void OnDownloadFileCompleted(DownloadItem* download); 675 virtual void OnDownloadFileCompleted(DownloadItem* download);
675 virtual void OnDownloadOpened(DownloadItem* download) { } 676 virtual void OnDownloadOpened(DownloadItem* download) { }
677 virtual void OnDownloadInterrupted(DownloadItem* download);
676 678
677 private: 679 private:
680 void RemoveAndCleanupOnLastEntry(DownloadItem* download);
681
678 AutomationProvider* provider_; 682 AutomationProvider* provider_;
679 IPC::Message* reply_message_; 683 IPC::Message* reply_message_;
680 int downloads_; 684 int downloads_;
685 bool interrupted_;
681 686
682 DISALLOW_COPY_AND_ASSIGN(AutomationProviderDownloadItemObserver); 687 DISALLOW_COPY_AND_ASSIGN(AutomationProviderDownloadItemObserver);
683 }; 688 };
684 689
685 // Allows the automation provider to wait until the download has been updated 690 // Allows the automation provider to wait until the download has been updated
686 // or opened. 691 // or opened.
687 class AutomationProviderDownloadUpdatedObserver 692 class AutomationProviderDownloadUpdatedObserver
688 : public DownloadItem::Observer { 693 : public DownloadItem::Observer {
689 public: 694 public:
690 AutomationProviderDownloadUpdatedObserver( 695 AutomationProviderDownloadUpdatedObserver(
691 AutomationProvider* provider, 696 AutomationProvider* provider,
692 IPC::Message* reply_message, 697 IPC::Message* reply_message,
693 bool wait_for_open) 698 bool wait_for_open)
694 : provider_(provider), 699 : provider_(provider),
695 reply_message_(reply_message), 700 reply_message_(reply_message),
696 wait_for_open_(wait_for_open) {} 701 wait_for_open_(wait_for_open) {}
697 702
698 virtual void OnDownloadUpdated(DownloadItem* download); 703 virtual void OnDownloadUpdated(DownloadItem* download);
699 virtual void OnDownloadOpened(DownloadItem* download); 704 virtual void OnDownloadOpened(DownloadItem* download);
700 virtual void OnDownloadFileCompleted(DownloadItem* download) { } 705 virtual void OnDownloadFileCompleted(DownloadItem* download) { }
706 virtual void OnDownloadInterrupted(DownloadItem* download) { }
701 707
702 private: 708 private:
703 AutomationProvider* provider_; 709 AutomationProvider* provider_;
704 IPC::Message* reply_message_; 710 IPC::Message* reply_message_;
705 bool wait_for_open_; 711 bool wait_for_open_;
706 712
707 DISALLOW_COPY_AND_ASSIGN(AutomationProviderDownloadUpdatedObserver); 713 DISALLOW_COPY_AND_ASSIGN(AutomationProviderDownloadUpdatedObserver);
708 }; 714 };
709 715
710 // Allows the automation provider to wait until the download model has changed 716 // Allows the automation provider to wait until the download model has changed
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 862
857 private: 863 private:
858 NotificationRegistrar registrar_; 864 NotificationRegistrar registrar_;
859 AutomationProvider* automation_; 865 AutomationProvider* automation_;
860 IPC::Message* reply_message_; 866 IPC::Message* reply_message_;
861 867
862 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver); 868 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver);
863 }; 869 };
864 870
865 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ 871 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698