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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "chrome/browser/password_manager/password_store_consumer.h" | 44 #include "chrome/browser/password_manager/password_store_consumer.h" |
45 #include "chrome/browser/search_engines/template_url_service_observer.h" | 45 #include "chrome/browser/search_engines/template_url_service_observer.h" |
46 #include "chrome/browser/tabs/tab_strip_model.h" | 46 #include "chrome/browser/tabs/tab_strip_model.h" |
47 #include "chrome/common/automation_constants.h" | 47 #include "chrome/common/automation_constants.h" |
48 #include "chrome/common/extensions/extension_constants.h" | 48 #include "chrome/common/extensions/extension_constants.h" |
49 #include "content/public/browser/download_item.h" | 49 #include "content/public/browser/download_item.h" |
50 #include "content/public/browser/download_manager.h" | 50 #include "content/public/browser/download_manager.h" |
51 #include "content/public/browser/notification_observer.h" | 51 #include "content/public/browser/notification_observer.h" |
52 #include "content/public/browser/notification_registrar.h" | 52 #include "content/public/browser/notification_registrar.h" |
53 #include "content/public/browser/notification_types.h" | 53 #include "content/public/browser/notification_types.h" |
| 54 #include "content/public/browser/render_view_host_observer.h" |
| 55 #include "ui/gfx/point.h" |
54 #include "ui/gfx/size.h" | 56 #include "ui/gfx/size.h" |
55 | 57 |
| 58 struct AutomationMouseEvent; |
56 class AutomationProvider; | 59 class AutomationProvider; |
57 class BalloonCollection; | 60 class BalloonCollection; |
58 class Browser; | 61 class Browser; |
59 class Extension; | 62 class Extension; |
60 class ExtensionProcessManager; | 63 class ExtensionProcessManager; |
61 class ExtensionService; | 64 class ExtensionService; |
62 class InfoBarTabHelper; | 65 class InfoBarTabHelper; |
63 class Notification; | 66 class Notification; |
64 class Profile; | 67 class Profile; |
65 class SavePackage; | 68 class SavePackage; |
66 class TranslateInfoBarDelegate; | 69 class TranslateInfoBarDelegate; |
67 | 70 |
| 71 namespace automation { |
| 72 class Error; |
| 73 } |
| 74 |
68 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
69 namespace chromeos { | 76 namespace chromeos { |
70 class ExistingUserController; | 77 class ExistingUserController; |
71 } | 78 } |
72 #endif // defined(OS_CHROMEOS) | 79 #endif // defined(OS_CHROMEOS) |
73 | 80 |
74 namespace IPC { | 81 namespace IPC { |
75 class Message; | 82 class Message; |
76 } | 83 } |
77 | 84 |
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 | 1315 |
1309 base::WeakPtr<AutomationProvider> automation_; | 1316 base::WeakPtr<AutomationProvider> automation_; |
1310 scoped_ptr<IPC::Message> reply_message_; | 1317 scoped_ptr<IPC::Message> reply_message_; |
1311 TabContentsWrapper* tab_contents_; | 1318 TabContentsWrapper* tab_contents_; |
1312 FilePath image_path_; | 1319 FilePath image_path_; |
1313 content::NotificationRegistrar registrar_; | 1320 content::NotificationRegistrar registrar_; |
1314 | 1321 |
1315 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker); | 1322 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker); |
1316 }; | 1323 }; |
1317 | 1324 |
| 1325 // Processes automation mouse events and invokes a callback when processing |
| 1326 // has completed. |
| 1327 class AutomationMouseEventProcessor : public content::RenderViewHostObserver, |
| 1328 public content::NotificationObserver { |
| 1329 public: |
| 1330 typedef base::Callback<void(const gfx::Point&)> CompletionCallback; |
| 1331 typedef base::Callback<void(const automation::Error&)> ErrorCallback; |
| 1332 |
| 1333 // Creates a new processor which immediately processes the given event. |
| 1334 // Either the |completion_callback| or |error_callback| will be called |
| 1335 // exactly once. After invoking the callback, this class will delete itself. |
| 1336 // The |completion_callback| will be given the point at which the mouse event |
| 1337 // occurred. |
| 1338 AutomationMouseEventProcessor(content::RenderViewHost* render_view_host, |
| 1339 const AutomationMouseEvent& event, |
| 1340 const CompletionCallback& completion_callback, |
| 1341 const ErrorCallback& error_callback); |
| 1342 virtual ~AutomationMouseEventProcessor(); |
| 1343 |
| 1344 private: |
| 1345 // IPC message handlers. |
| 1346 virtual void OnWillProcessMouseEventAt(const gfx::Point& point) OVERRIDE; |
| 1347 virtual void OnProcessMouseEventACK( |
| 1348 bool success, |
| 1349 const std::string& error_msg) OVERRIDE; |
| 1350 |
| 1351 // RenderViewHostObserver overrides. |
| 1352 virtual void RenderViewHostDestroyed(content::RenderViewHost* host) OVERRIDE; |
| 1353 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 1354 |
| 1355 // NotificationObserver overrides. |
| 1356 virtual void Observe(int type, |
| 1357 const content::NotificationSource& source, |
| 1358 const content::NotificationDetails& details) OVERRIDE; |
| 1359 |
| 1360 // Helper method to invoke the appropriate callback. Uses the given error |
| 1361 // only if the operation failed. Deletes this. |
| 1362 void InvokeCallback(const automation::Error& error); |
| 1363 |
| 1364 content::NotificationRegistrar registrar_; |
| 1365 CompletionCallback completion_callback_; |
| 1366 ErrorCallback error_callback_; |
| 1367 bool has_point_; |
| 1368 gfx::Point point_; |
| 1369 |
| 1370 DISALLOW_COPY_AND_ASSIGN(AutomationMouseEventProcessor); |
| 1371 }; |
| 1372 |
1318 class NTPInfoObserver : public content::NotificationObserver { | 1373 class NTPInfoObserver : public content::NotificationObserver { |
1319 public: | 1374 public: |
1320 NTPInfoObserver(AutomationProvider* automation, | 1375 NTPInfoObserver(AutomationProvider* automation, |
1321 IPC::Message* reply_message, | 1376 IPC::Message* reply_message, |
1322 CancelableRequestConsumer* consumer); | 1377 CancelableRequestConsumer* consumer); |
1323 virtual ~NTPInfoObserver(); | 1378 virtual ~NTPInfoObserver(); |
1324 | 1379 |
1325 virtual void Observe(int type, | 1380 virtual void Observe(int type, |
1326 const content::NotificationSource& source, | 1381 const content::NotificationSource& source, |
1327 const content::NotificationDetails& details); | 1382 const content::NotificationDetails& details); |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 private: | 1865 private: |
1811 base::WeakPtr<AutomationProvider> automation_; | 1866 base::WeakPtr<AutomationProvider> automation_; |
1812 scoped_ptr<IPC::Message> reply_message_; | 1867 scoped_ptr<IPC::Message> reply_message_; |
1813 std::string extension_id_; | 1868 std::string extension_id_; |
1814 content::NotificationRegistrar registrar_; | 1869 content::NotificationRegistrar registrar_; |
1815 | 1870 |
1816 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupObserver); | 1871 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupObserver); |
1817 }; | 1872 }; |
1818 | 1873 |
1819 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 1874 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
OLD | NEW |