| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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> |
| 11 #include <set> | 11 #include <set> |
| 12 | 12 |
| 13 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 13 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
| 14 #include "chrome/browser/browsing_data_remover.h" | 14 #include "chrome/browser/browsing_data_remover.h" |
| 15 #include "chrome/browser/download/download_item.h" | 15 #include "chrome/browser/download/download_item.h" |
| 16 #include "chrome/browser/download/download_manager.h" | 16 #include "chrome/browser/download/download_manager.h" |
| 17 #include "chrome/browser/history/history.h" |
| 17 #include "chrome/browser/importer/importer.h" | 18 #include "chrome/browser/importer/importer.h" |
| 18 #include "chrome/browser/importer/importer_data_types.h" | 19 #include "chrome/browser/importer/importer_data_types.h" |
| 19 #include "chrome/browser/password_manager/password_store.h" | 20 #include "chrome/browser/password_manager/password_store.h" |
| 20 #include "chrome/browser/tab_contents/tab_contents.h" | 21 #include "chrome/browser/tab_contents/tab_contents.h" |
| 21 #include "chrome/common/notification_observer.h" | 22 #include "chrome/common/notification_observer.h" |
| 22 #include "chrome/common/notification_registrar.h" | 23 #include "chrome/common/notification_registrar.h" |
| 23 #include "chrome/common/notification_type.h" | 24 #include "chrome/common/notification_type.h" |
| 24 #include "chrome/test/automation/automation_messages.h" | 25 #include "chrome/test/automation/automation_messages.h" |
| 25 | 26 |
| 26 class AutomationProvider; | 27 class AutomationProvider; |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 // observer list). | 590 // observer list). |
| 590 void ReplyAndDelete(bool success); | 591 void ReplyAndDelete(bool success); |
| 591 | 592 |
| 592 scoped_refptr<AutomationProvider> automation_provider_; | 593 scoped_refptr<AutomationProvider> automation_provider_; |
| 593 IPC::Message* reply_message_; | 594 IPC::Message* reply_message_; |
| 594 BookmarkModel* model_; | 595 BookmarkModel* model_; |
| 595 | 596 |
| 596 DISALLOW_COPY_AND_ASSIGN(AutomationProviderBookmarkModelObserver); | 597 DISALLOW_COPY_AND_ASSIGN(AutomationProviderBookmarkModelObserver); |
| 597 }; | 598 }; |
| 598 | 599 |
| 599 // When asked for pending downloads, the DownloadManager places | |
| 600 // results in a DownloadManager::Observer. | |
| 601 class AutomationProviderDownloadManagerObserver | |
| 602 : public DownloadManager::Observer { | |
| 603 public: | |
| 604 AutomationProviderDownloadManagerObserver() : DownloadManager::Observer() {} | |
| 605 virtual ~AutomationProviderDownloadManagerObserver() {} | |
| 606 virtual void ModelChanged() {} | |
| 607 virtual void SetDownloads(std::vector<DownloadItem*>& downloads) { | |
| 608 downloads_ = downloads; | |
| 609 } | |
| 610 std::vector<DownloadItem*> Downloads() { | |
| 611 return downloads_; | |
| 612 } | |
| 613 private: | |
| 614 std::vector<DownloadItem*> downloads_; | |
| 615 | |
| 616 DISALLOW_COPY_AND_ASSIGN(AutomationProviderDownloadManagerObserver); | |
| 617 }; | |
| 618 | |
| 619 | |
| 620 // Allows the automation provider to wait for all downloads to finish. | 600 // Allows the automation provider to wait for all downloads to finish. |
| 621 class AutomationProviderDownloadItemObserver : public DownloadItem::Observer { | 601 class AutomationProviderDownloadItemObserver : public DownloadItem::Observer { |
| 622 public: | 602 public: |
| 623 AutomationProviderDownloadItemObserver( | 603 AutomationProviderDownloadItemObserver( |
| 624 AutomationProvider* provider, | 604 AutomationProvider* provider, |
| 625 IPC::Message* reply_message, | 605 IPC::Message* reply_message, |
| 626 int downloads) { | 606 int downloads) { |
| 627 provider_ = provider; | 607 provider_ = provider; |
| 628 reply_message_ = reply_message; | 608 reply_message_ = reply_message; |
| 629 downloads_ = downloads; | 609 downloads_ = downloads; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 void ImportStarted() {} | 652 void ImportStarted() {} |
| 673 void ImportItemStarted(importer::ImportItem item) {} | 653 void ImportItemStarted(importer::ImportItem item) {} |
| 674 void ImportItemEnded(importer::ImportItem item) {} | 654 void ImportItemEnded(importer::ImportItem item) {} |
| 675 void ImportEnded(); | 655 void ImportEnded(); |
| 676 private: | 656 private: |
| 677 AutomationProvider* provider_; | 657 AutomationProvider* provider_; |
| 678 IPC::Message* reply_message_; | 658 IPC::Message* reply_message_; |
| 679 }; | 659 }; |
| 680 | 660 |
| 681 // Allows automation provider to wait for getting passwords to finish. | 661 // Allows automation provider to wait for getting passwords to finish. |
| 682 class AutomationProviderGetPasswordsObserver : | 662 class AutomationProviderGetPasswordsObserver |
| 683 public PasswordStoreConsumer { | 663 : public PasswordStoreConsumer { |
| 684 public: | 664 public: |
| 685 AutomationProviderGetPasswordsObserver( | 665 AutomationProviderGetPasswordsObserver( |
| 686 AutomationProvider* provider, | 666 AutomationProvider* provider, |
| 687 IPC::Message* reply_message) | 667 IPC::Message* reply_message) |
| 688 : provider_(provider), | 668 : provider_(provider), |
| 689 reply_message_(reply_message) {} | 669 reply_message_(reply_message) {} |
| 690 | 670 |
| 691 void OnPasswordStoreRequestDone( | 671 void OnPasswordStoreRequestDone( |
| 692 int handle, const std::vector<webkit_glue::PasswordForm*>& result); | 672 int handle, const std::vector<webkit_glue::PasswordForm*>& result); |
| 693 | 673 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 NotificationRegistrar registrar_; | 752 NotificationRegistrar registrar_; |
| 773 AutomationProvider* automation_; | 753 AutomationProvider* automation_; |
| 774 IPC::Message* reply_message_; | 754 IPC::Message* reply_message_; |
| 775 TabContents* tab_contents_; | 755 TabContents* tab_contents_; |
| 776 int count_; | 756 int count_; |
| 777 | 757 |
| 778 DISALLOW_COPY_AND_ASSIGN(WaitForInfobarCountObserver); | 758 DISALLOW_COPY_AND_ASSIGN(WaitForInfobarCountObserver); |
| 779 }; | 759 }; |
| 780 | 760 |
| 781 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 761 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
| OLD | NEW |