| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 const NotificationDetails& details); | 500 const NotificationDetails& details); |
| 501 | 501 |
| 502 virtual void OnDomOperationCompleted(const std::string& json) = 0; | 502 virtual void OnDomOperationCompleted(const std::string& json) = 0; |
| 503 | 503 |
| 504 private: | 504 private: |
| 505 NotificationRegistrar registrar_; | 505 NotificationRegistrar registrar_; |
| 506 | 506 |
| 507 DISALLOW_COPY_AND_ASSIGN(DomOperationObserver); | 507 DISALLOW_COPY_AND_ASSIGN(DomOperationObserver); |
| 508 }; | 508 }; |
| 509 | 509 |
| 510 // Sends a message back to the automation client with the results of the DOM |
| 511 // operation. |
| 510 class DomOperationMessageSender : public DomOperationObserver { | 512 class DomOperationMessageSender : public DomOperationObserver { |
| 511 public: | 513 public: |
| 512 explicit DomOperationMessageSender(AutomationProvider* automation); | 514 explicit DomOperationMessageSender(AutomationProvider* automation, |
| 515 IPC::Message* relpy_message, |
| 516 bool use_json_interface); |
| 513 virtual ~DomOperationMessageSender(); | 517 virtual ~DomOperationMessageSender(); |
| 514 | 518 |
| 515 virtual void OnDomOperationCompleted(const std::string& json); | 519 virtual void OnDomOperationCompleted(const std::string& json); |
| 516 | 520 |
| 517 private: | 521 private: |
| 518 base::WeakPtr<AutomationProvider> automation_; | 522 base::WeakPtr<AutomationProvider> automation_; |
| 523 scoped_ptr<IPC::Message> reply_message_; |
| 524 bool use_json_interface_; |
| 519 | 525 |
| 520 DISALLOW_COPY_AND_ASSIGN(DomOperationMessageSender); | 526 DISALLOW_COPY_AND_ASSIGN(DomOperationMessageSender); |
| 521 }; | 527 }; |
| 522 | 528 |
| 523 class DocumentPrintedNotificationObserver : public NotificationObserver { | 529 class DocumentPrintedNotificationObserver : public NotificationObserver { |
| 524 public: | 530 public: |
| 525 DocumentPrintedNotificationObserver(AutomationProvider* automation, | 531 DocumentPrintedNotificationObserver(AutomationProvider* automation, |
| 526 IPC::Message* reply_message); | 532 IPC::Message* reply_message); |
| 527 virtual ~DocumentPrintedNotificationObserver(); | 533 virtual ~DocumentPrintedNotificationObserver(); |
| 528 | 534 |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 | 1151 |
| 1146 // Sends the |reply_message_| to |automation_| indicating we're done. | 1152 // Sends the |reply_message_| to |automation_| indicating we're done. |
| 1147 void RunOnUIThread(); | 1153 void RunOnUIThread(); |
| 1148 | 1154 |
| 1149 base::WeakPtr<AutomationProvider> automation_; | 1155 base::WeakPtr<AutomationProvider> automation_; |
| 1150 scoped_ptr<IPC::Message> reply_message_; | 1156 scoped_ptr<IPC::Message> reply_message_; |
| 1151 | 1157 |
| 1152 DISALLOW_COPY_AND_ASSIGN(WaitForProcessLauncherThreadToGoIdleObserver); | 1158 DISALLOW_COPY_AND_ASSIGN(WaitForProcessLauncherThreadToGoIdleObserver); |
| 1153 }; | 1159 }; |
| 1154 | 1160 |
| 1155 // Observes the result of execution of Javascript and sends a JSON reply. | |
| 1156 class ExecuteJavascriptObserver : public DomOperationObserver { | |
| 1157 public: | |
| 1158 ExecuteJavascriptObserver(AutomationProvider* automation, | |
| 1159 IPC::Message* reply_message); | |
| 1160 virtual ~ExecuteJavascriptObserver(); | |
| 1161 | |
| 1162 private: | |
| 1163 // Overriden from DomOperationObserver. | |
| 1164 virtual void OnDomOperationCompleted(const std::string& json); | |
| 1165 | |
| 1166 base::WeakPtr<AutomationProvider> automation_; | |
| 1167 scoped_ptr<IPC::Message> reply_message_; | |
| 1168 | |
| 1169 DISALLOW_COPY_AND_ASSIGN(ExecuteJavascriptObserver); | |
| 1170 }; | |
| 1171 | |
| 1172 | |
| 1173 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 1161 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
| OLD | NEW |