OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 struct AutomationMouseEvent; | 55 struct AutomationMouseEvent; |
56 class AutomationProvider; | 56 class AutomationProvider; |
57 class BalloonCollection; | 57 class BalloonCollection; |
58 class Browser; | 58 class Browser; |
59 class ExtensionProcessManager; | 59 class ExtensionProcessManager; |
60 class ExtensionService; | 60 class ExtensionService; |
61 class InfoBarTabHelper; | 61 class InfoBarTabHelper; |
62 class Notification; | 62 class Notification; |
63 class Profile; | 63 class Profile; |
64 class SavePackage; | 64 class SavePackage; |
65 class TabContents; | |
66 | 65 |
67 namespace automation { | 66 namespace automation { |
68 class Error; | 67 class Error; |
69 } | 68 } |
70 | 69 |
71 #if defined(OS_CHROMEOS) | 70 #if defined(OS_CHROMEOS) |
72 namespace chromeos { | 71 namespace chromeos { |
73 class ExistingUserController; | 72 class ExistingUserController; |
74 class WizardScreen; | 73 class WizardScreen; |
75 } | 74 } |
76 #endif // defined(OS_CHROMEOS) | 75 #endif // defined(OS_CHROMEOS) |
77 | 76 |
78 namespace IPC { | |
79 class Message; | |
80 } | |
81 | |
82 namespace content { | 77 namespace content { |
83 class NavigationController; | 78 class NavigationController; |
84 class RenderViewHost; | 79 class RenderViewHost; |
85 class WebContents; | 80 class WebContents; |
86 } | 81 } |
87 | 82 |
88 namespace extensions { | 83 namespace extensions { |
89 class Extension; | 84 class Extension; |
90 } | 85 } |
91 | 86 |
92 namespace history { | 87 namespace history { |
93 class TopSites; | 88 class TopSites; |
94 } | 89 } |
95 | 90 |
| 91 namespace IPC { |
| 92 class Message; |
| 93 } |
| 94 |
96 namespace policy { | 95 namespace policy { |
97 class BrowserPolicyConnector; | 96 class BrowserPolicyConnector; |
98 } | 97 } |
99 | 98 |
100 class InitialLoadObserver : public content::NotificationObserver { | 99 class InitialLoadObserver : public content::NotificationObserver { |
101 public: | 100 public: |
102 InitialLoadObserver(size_t tab_count, AutomationProvider* automation); | 101 InitialLoadObserver(size_t tab_count, AutomationProvider* automation); |
103 virtual ~InitialLoadObserver(); | 102 virtual ~InitialLoadObserver(); |
104 | 103 |
105 // Overridden from content::NotificationObserver: | 104 // Overridden from content::NotificationObserver: |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 typedef std::map<std::string, int> EventDurationMap; | 650 typedef std::map<std::string, int> EventDurationMap; |
652 EventDurationMap durations_; | 651 EventDurationMap durations_; |
653 | 652 |
654 DISALLOW_COPY_AND_ASSIGN(MetricEventDurationObserver); | 653 DISALLOW_COPY_AND_ASSIGN(MetricEventDurationObserver); |
655 }; | 654 }; |
656 | 655 |
657 class InfoBarCountObserver : public content::NotificationObserver { | 656 class InfoBarCountObserver : public content::NotificationObserver { |
658 public: | 657 public: |
659 InfoBarCountObserver(AutomationProvider* automation, | 658 InfoBarCountObserver(AutomationProvider* automation, |
660 IPC::Message* reply_message, | 659 IPC::Message* reply_message, |
661 TabContents* tab_contents, | 660 content::WebContents* web_contents, |
662 size_t target_count); | 661 size_t target_count); |
663 virtual ~InfoBarCountObserver(); | 662 virtual ~InfoBarCountObserver(); |
664 | 663 |
665 // Overridden from content::NotificationObserver: | 664 // Overridden from content::NotificationObserver: |
666 virtual void Observe(int type, | 665 virtual void Observe(int type, |
667 const content::NotificationSource& source, | 666 const content::NotificationSource& source, |
668 const content::NotificationDetails& details) OVERRIDE; | 667 const content::NotificationDetails& details) OVERRIDE; |
669 | 668 |
670 private: | 669 private: |
671 // Checks whether the infobar count matches our target, and if so | 670 // Checks whether the infobar count matches our target, and if so |
672 // sends the reply message and deletes itself. | 671 // sends the reply message and deletes itself. |
673 void CheckCount(); | 672 void CheckCount(); |
674 | 673 |
675 content::NotificationRegistrar registrar_; | 674 content::NotificationRegistrar registrar_; |
676 base::WeakPtr<AutomationProvider> automation_; | 675 base::WeakPtr<AutomationProvider> automation_; |
677 scoped_ptr<IPC::Message> reply_message_; | 676 scoped_ptr<IPC::Message> reply_message_; |
678 TabContents* tab_contents_; | 677 content::WebContents* web_contents_; |
679 | 678 |
680 const size_t target_count_; | 679 const size_t target_count_; |
681 | 680 |
682 DISALLOW_COPY_AND_ASSIGN(InfoBarCountObserver); | 681 DISALLOW_COPY_AND_ASSIGN(InfoBarCountObserver); |
683 }; | 682 }; |
684 | 683 |
685 #if defined(OS_CHROMEOS) | 684 #if defined(OS_CHROMEOS) |
686 class LoginObserver : public chromeos::LoginStatusConsumer { | 685 class LoginObserver : public chromeos::LoginStatusConsumer { |
687 public: | 686 public: |
688 LoginObserver(chromeos::ExistingUserController* controller, | 687 LoginObserver(chromeos::ExistingUserController* controller, |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 | 1262 |
1264 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver); | 1263 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver); |
1265 }; | 1264 }; |
1266 | 1265 |
1267 // This class manages taking a snapshot of a page. | 1266 // This class manages taking a snapshot of a page. |
1268 class PageSnapshotTaker : public TabEventObserver, | 1267 class PageSnapshotTaker : public TabEventObserver, |
1269 public content::NotificationObserver { | 1268 public content::NotificationObserver { |
1270 public: | 1269 public: |
1271 PageSnapshotTaker(AutomationProvider* automation, | 1270 PageSnapshotTaker(AutomationProvider* automation, |
1272 IPC::Message* reply_message, | 1271 IPC::Message* reply_message, |
1273 TabContents* tab_contents, | 1272 content::WebContents* web_contents, |
1274 const FilePath& path); | 1273 const FilePath& path); |
1275 virtual ~PageSnapshotTaker(); | 1274 virtual ~PageSnapshotTaker(); |
1276 | 1275 |
1277 // Start the process of taking a snapshot of the entire page. | 1276 // Start the process of taking a snapshot of the entire page. |
1278 void Start(); | 1277 void Start(); |
1279 | 1278 |
1280 private: | 1279 private: |
1281 // Overridden from TabEventObserver: | 1280 // Overridden from TabEventObserver: |
1282 virtual void OnSnapshotEntirePageACK( | 1281 virtual void OnSnapshotEntirePageACK( |
1283 bool success, | 1282 bool success, |
1284 const std::vector<unsigned char>& png_data, | 1283 const std::vector<unsigned char>& png_data, |
1285 const std::string& error_msg) OVERRIDE; | 1284 const std::string& error_msg) OVERRIDE; |
1286 | 1285 |
1287 // Overridden from content::NotificationObserver: | 1286 // Overridden from content::NotificationObserver: |
1288 virtual void Observe(int type, | 1287 virtual void Observe(int type, |
1289 const content::NotificationSource& source, | 1288 const content::NotificationSource& source, |
1290 const content::NotificationDetails& details) OVERRIDE; | 1289 const content::NotificationDetails& details) OVERRIDE; |
1291 | 1290 |
1292 // Helper method to send a response back to the client. Deletes this. | 1291 // Helper method to send a response back to the client. Deletes this. |
1293 void SendMessage(bool success, const std::string& error_msg); | 1292 void SendMessage(bool success, const std::string& error_msg); |
1294 | 1293 |
1295 base::WeakPtr<AutomationProvider> automation_; | 1294 base::WeakPtr<AutomationProvider> automation_; |
1296 scoped_ptr<IPC::Message> reply_message_; | 1295 scoped_ptr<IPC::Message> reply_message_; |
1297 TabContents* tab_contents_; | 1296 content::WebContents* web_contents_; |
1298 FilePath image_path_; | 1297 FilePath image_path_; |
1299 content::NotificationRegistrar registrar_; | 1298 content::NotificationRegistrar registrar_; |
1300 | 1299 |
1301 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker); | 1300 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker); |
1302 }; | 1301 }; |
1303 | 1302 |
1304 // Processes automation mouse events and invokes a callback when processing | 1303 // Processes automation mouse events and invokes a callback when processing |
1305 // has completed. | 1304 // has completed. |
1306 class AutomationMouseEventProcessor : public content::RenderViewHostObserver, | 1305 class AutomationMouseEventProcessor : public content::RenderViewHostObserver, |
1307 public content::NotificationObserver { | 1306 public content::NotificationObserver { |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 base::WeakPtr<AutomationProvider> automation_; | 1798 base::WeakPtr<AutomationProvider> automation_; |
1800 scoped_ptr<IPC::Message> reply_message_; | 1799 scoped_ptr<IPC::Message> reply_message_; |
1801 int new_window_id_; | 1800 int new_window_id_; |
1802 int num_loads_; | 1801 int num_loads_; |
1803 | 1802 |
1804 DISALLOW_COPY_AND_ASSIGN( | 1803 DISALLOW_COPY_AND_ASSIGN( |
1805 BrowserOpenedWithExistingProfileNotificationObserver); | 1804 BrowserOpenedWithExistingProfileNotificationObserver); |
1806 }; | 1805 }; |
1807 | 1806 |
1808 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 1807 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
OLD | NEW |