| 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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver); | 941 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver); |
| 942 }; | 942 }; |
| 943 | 943 |
| 944 // This class manages taking a snapshot of a page. This requires waiting on | 944 // This class manages taking a snapshot of a page. This requires waiting on |
| 945 // asynchronous callbacks and notifications. | 945 // asynchronous callbacks and notifications. |
| 946 class PageSnapshotTaker : public DomOperationObserver { | 946 class PageSnapshotTaker : public DomOperationObserver { |
| 947 public: | 947 public: |
| 948 PageSnapshotTaker(AutomationProvider* automation, | 948 PageSnapshotTaker(AutomationProvider* automation, |
| 949 IPC::Message* reply_message, | 949 IPC::Message* reply_message, |
| 950 RenderViewHost* render_view, | 950 RenderViewHost* render_view, |
| 951 const FilePath& path); | 951 const FilePath& path, |
| 952 bool use_json_interface); |
| 952 virtual ~PageSnapshotTaker(); | 953 virtual ~PageSnapshotTaker(); |
| 953 | 954 |
| 954 // Start the process of taking a snapshot of the entire page. | 955 // Start the process of taking a snapshot of the entire page. |
| 955 void Start(); | 956 void Start(); |
| 956 | 957 |
| 957 private: | 958 private: |
| 958 // Overriden from DomOperationObserver. | 959 // Overriden from DomOperationObserver. |
| 959 virtual void OnDomOperationCompleted(const std::string& json); | 960 virtual void OnDomOperationCompleted(const std::string& json); |
| 960 | 961 |
| 961 // Called by the ThumbnailGenerator when the requested snapshot has been | 962 // Called by the ThumbnailGenerator when the requested snapshot has been |
| 962 // generated. | 963 // generated. |
| 963 void OnSnapshotTaken(const SkBitmap& bitmap); | 964 void OnSnapshotTaken(const SkBitmap& bitmap); |
| 964 | 965 |
| 965 // Helper method to send arbitrary javascript to the renderer for evaluation. | 966 // Helper method to send arbitrary javascript to the renderer for evaluation. |
| 966 void ExecuteScript(const std::wstring& javascript); | 967 void ExecuteScript(const std::wstring& javascript); |
| 967 | 968 |
| 968 // Helper method to send a response back to the client. Deletes this. | 969 // Helper method to send a response back to the client. Deletes this. |
| 969 void SendMessage(bool success); | 970 void SendMessage(bool success); |
| 970 | 971 |
| 971 base::WeakPtr<AutomationProvider> automation_; | 972 base::WeakPtr<AutomationProvider> automation_; |
| 972 scoped_ptr<IPC::Message> reply_message_; | 973 scoped_ptr<IPC::Message> reply_message_; |
| 973 RenderViewHost* render_view_; | 974 RenderViewHost* render_view_; |
| 974 FilePath image_path_; | 975 FilePath image_path_; |
| 975 bool received_width_; | 976 bool received_width_; |
| 977 bool use_json_interface_; |
| 976 gfx::Size entire_page_size_; | 978 gfx::Size entire_page_size_; |
| 977 | 979 |
| 978 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker); | 980 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker); |
| 979 }; | 981 }; |
| 980 | 982 |
| 981 class NTPInfoObserver : public NotificationObserver { | 983 class NTPInfoObserver : public NotificationObserver { |
| 982 public: | 984 public: |
| 983 NTPInfoObserver(AutomationProvider* automation, | 985 NTPInfoObserver(AutomationProvider* automation, |
| 984 IPC::Message* reply_message, | 986 IPC::Message* reply_message, |
| 985 CancelableRequestConsumer* consumer); | 987 CancelableRequestConsumer* consumer); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 // Sends the |reply_message_| to |automation_| indicating we're done. | 1179 // Sends the |reply_message_| to |automation_| indicating we're done. |
| 1178 void RunOnUIThread(); | 1180 void RunOnUIThread(); |
| 1179 | 1181 |
| 1180 base::WeakPtr<AutomationProvider> automation_; | 1182 base::WeakPtr<AutomationProvider> automation_; |
| 1181 scoped_ptr<IPC::Message> reply_message_; | 1183 scoped_ptr<IPC::Message> reply_message_; |
| 1182 | 1184 |
| 1183 DISALLOW_COPY_AND_ASSIGN(WaitForProcessLauncherThreadToGoIdleObserver); | 1185 DISALLOW_COPY_AND_ASSIGN(WaitForProcessLauncherThreadToGoIdleObserver); |
| 1184 }; | 1186 }; |
| 1185 | 1187 |
| 1186 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 1188 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
| OLD | NEW |