| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 }; | 300 }; |
| 301 | 301 |
| 302 // Notifies when the tab count reaches the target number. | 302 // Notifies when the tab count reaches the target number. |
| 303 class TabCountChangeObserver : public TabStripModelObserver { | 303 class TabCountChangeObserver : public TabStripModelObserver { |
| 304 public: | 304 public: |
| 305 TabCountChangeObserver(AutomationProvider* automation, | 305 TabCountChangeObserver(AutomationProvider* automation, |
| 306 Browser* browser, | 306 Browser* browser, |
| 307 IPC::Message* reply_message, | 307 IPC::Message* reply_message, |
| 308 int target_tab_count); | 308 int target_tab_count); |
| 309 // Implementation of TabStripModelObserver. | 309 // Implementation of TabStripModelObserver. |
| 310 virtual void TabInsertedAt(TabContentsWrapper* contents, | 310 virtual void TabInsertedAt(TabContents* contents, |
| 311 int index, | 311 int index, |
| 312 bool foreground); | 312 bool foreground); |
| 313 virtual void TabDetachedAt(TabContentsWrapper* contents, int index); | 313 virtual void TabDetachedAt(TabContents* contents, int index); |
| 314 virtual void TabStripModelDeleted(); | 314 virtual void TabStripModelDeleted(); |
| 315 | 315 |
| 316 private: | 316 private: |
| 317 virtual ~TabCountChangeObserver(); | 317 virtual ~TabCountChangeObserver(); |
| 318 | 318 |
| 319 // Checks if the current tab count matches our target, and if so, | 319 // Checks if the current tab count matches our target, and if so, |
| 320 // sends the reply message and deletes self. | 320 // sends the reply message and deletes self. |
| 321 void CheckTabCount(); | 321 void CheckTabCount(); |
| 322 | 322 |
| 323 base::WeakPtr<AutomationProvider> automation_; | 323 base::WeakPtr<AutomationProvider> automation_; |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 content::WebContents* web_contents_; | 664 content::WebContents* web_contents_; |
| 665 TranslateInfoBarDelegate* translate_bar_; | 665 TranslateInfoBarDelegate* translate_bar_; |
| 666 | 666 |
| 667 DISALLOW_COPY_AND_ASSIGN(TabLanguageDeterminedObserver); | 667 DISALLOW_COPY_AND_ASSIGN(TabLanguageDeterminedObserver); |
| 668 }; | 668 }; |
| 669 | 669 |
| 670 class InfoBarCountObserver : public content::NotificationObserver { | 670 class InfoBarCountObserver : public content::NotificationObserver { |
| 671 public: | 671 public: |
| 672 InfoBarCountObserver(AutomationProvider* automation, | 672 InfoBarCountObserver(AutomationProvider* automation, |
| 673 IPC::Message* reply_message, | 673 IPC::Message* reply_message, |
| 674 TabContentsWrapper* tab_contents, | 674 TabContents* tab_contents, |
| 675 size_t target_count); | 675 size_t target_count); |
| 676 virtual ~InfoBarCountObserver(); | 676 virtual ~InfoBarCountObserver(); |
| 677 | 677 |
| 678 // content::NotificationObserver interface. | 678 // content::NotificationObserver interface. |
| 679 virtual void Observe(int type, | 679 virtual void Observe(int type, |
| 680 const content::NotificationSource& source, | 680 const content::NotificationSource& source, |
| 681 const content::NotificationDetails& details); | 681 const content::NotificationDetails& details); |
| 682 | 682 |
| 683 private: | 683 private: |
| 684 // Checks whether the infobar count matches our target, and if so | 684 // Checks whether the infobar count matches our target, and if so |
| 685 // sends the reply message and deletes itself. | 685 // sends the reply message and deletes itself. |
| 686 void CheckCount(); | 686 void CheckCount(); |
| 687 | 687 |
| 688 content::NotificationRegistrar registrar_; | 688 content::NotificationRegistrar registrar_; |
| 689 base::WeakPtr<AutomationProvider> automation_; | 689 base::WeakPtr<AutomationProvider> automation_; |
| 690 scoped_ptr<IPC::Message> reply_message_; | 690 scoped_ptr<IPC::Message> reply_message_; |
| 691 TabContentsWrapper* tab_contents_; | 691 TabContents* tab_contents_; |
| 692 | 692 |
| 693 const size_t target_count_; | 693 const size_t target_count_; |
| 694 | 694 |
| 695 DISALLOW_COPY_AND_ASSIGN(InfoBarCountObserver); | 695 DISALLOW_COPY_AND_ASSIGN(InfoBarCountObserver); |
| 696 }; | 696 }; |
| 697 | 697 |
| 698 #if defined(OS_CHROMEOS) | 698 #if defined(OS_CHROMEOS) |
| 699 class LoginObserver : public chromeos::LoginStatusConsumer { | 699 class LoginObserver : public chromeos::LoginStatusConsumer { |
| 700 public: | 700 public: |
| 701 LoginObserver(chromeos::ExistingUserController* controller, | 701 LoginObserver(chromeos::ExistingUserController* controller, |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 | 1311 |
| 1312 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver); | 1312 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver); |
| 1313 }; | 1313 }; |
| 1314 | 1314 |
| 1315 // This class manages taking a snapshot of a page. | 1315 // This class manages taking a snapshot of a page. |
| 1316 class PageSnapshotTaker : public TabEventObserver, | 1316 class PageSnapshotTaker : public TabEventObserver, |
| 1317 public content::NotificationObserver { | 1317 public content::NotificationObserver { |
| 1318 public: | 1318 public: |
| 1319 PageSnapshotTaker(AutomationProvider* automation, | 1319 PageSnapshotTaker(AutomationProvider* automation, |
| 1320 IPC::Message* reply_message, | 1320 IPC::Message* reply_message, |
| 1321 TabContentsWrapper* tab_contents, | 1321 TabContents* tab_contents, |
| 1322 const FilePath& path); | 1322 const FilePath& path); |
| 1323 virtual ~PageSnapshotTaker(); | 1323 virtual ~PageSnapshotTaker(); |
| 1324 | 1324 |
| 1325 // Start the process of taking a snapshot of the entire page. | 1325 // Start the process of taking a snapshot of the entire page. |
| 1326 void Start(); | 1326 void Start(); |
| 1327 | 1327 |
| 1328 private: | 1328 private: |
| 1329 // TabEventObserver overrides. | 1329 // TabEventObserver overrides. |
| 1330 virtual void OnSnapshotEntirePageACK( | 1330 virtual void OnSnapshotEntirePageACK( |
| 1331 bool success, | 1331 bool success, |
| 1332 const std::vector<unsigned char>& png_data, | 1332 const std::vector<unsigned char>& png_data, |
| 1333 const std::string& error_msg) OVERRIDE; | 1333 const std::string& error_msg) OVERRIDE; |
| 1334 // NotificationObserver overrides. | 1334 // NotificationObserver overrides. |
| 1335 virtual void Observe(int type, | 1335 virtual void Observe(int type, |
| 1336 const content::NotificationSource& source, | 1336 const content::NotificationSource& source, |
| 1337 const content::NotificationDetails& details); | 1337 const content::NotificationDetails& details); |
| 1338 | 1338 |
| 1339 // Helper method to send a response back to the client. Deletes this. | 1339 // Helper method to send a response back to the client. Deletes this. |
| 1340 void SendMessage(bool success, const std::string& error_msg); | 1340 void SendMessage(bool success, const std::string& error_msg); |
| 1341 | 1341 |
| 1342 base::WeakPtr<AutomationProvider> automation_; | 1342 base::WeakPtr<AutomationProvider> automation_; |
| 1343 scoped_ptr<IPC::Message> reply_message_; | 1343 scoped_ptr<IPC::Message> reply_message_; |
| 1344 TabContentsWrapper* tab_contents_; | 1344 TabContents* tab_contents_; |
| 1345 FilePath image_path_; | 1345 FilePath image_path_; |
| 1346 content::NotificationRegistrar registrar_; | 1346 content::NotificationRegistrar registrar_; |
| 1347 | 1347 |
| 1348 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker); | 1348 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker); |
| 1349 }; | 1349 }; |
| 1350 | 1350 |
| 1351 // Processes automation mouse events and invokes a callback when processing | 1351 // Processes automation mouse events and invokes a callback when processing |
| 1352 // has completed. | 1352 // has completed. |
| 1353 class AutomationMouseEventProcessor : public content::RenderViewHostObserver, | 1353 class AutomationMouseEventProcessor : public content::RenderViewHostObserver, |
| 1354 public content::NotificationObserver { | 1354 public content::NotificationObserver { |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1891 private: | 1891 private: |
| 1892 base::WeakPtr<AutomationProvider> automation_; | 1892 base::WeakPtr<AutomationProvider> automation_; |
| 1893 scoped_ptr<IPC::Message> reply_message_; | 1893 scoped_ptr<IPC::Message> reply_message_; |
| 1894 std::string extension_id_; | 1894 std::string extension_id_; |
| 1895 content::NotificationRegistrar registrar_; | 1895 content::NotificationRegistrar registrar_; |
| 1896 | 1896 |
| 1897 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupObserver); | 1897 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupObserver); |
| 1898 }; | 1898 }; |
| 1899 | 1899 |
| 1900 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 1900 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
| OLD | NEW |