Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: chrome/browser/automation/automation_provider_observers.h

Issue 10384023: Determine the element location and click synchronously on the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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/ui/tabs/tab_strip_model.h" 46 #include "chrome/browser/ui/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 ExtensionProcessManager; 62 class ExtensionProcessManager;
60 class ExtensionService; 63 class ExtensionService;
61 class InfoBarTabHelper; 64 class InfoBarTabHelper;
62 class Notification; 65 class Notification;
63 class Profile; 66 class Profile;
64 class SavePackage; 67 class SavePackage;
65 class TranslateInfoBarDelegate; 68 class TranslateInfoBarDelegate;
66 69
70 namespace automation {
71 class Error;
72 }
73
67 #if defined(OS_CHROMEOS) 74 #if defined(OS_CHROMEOS)
68 namespace chromeos { 75 namespace chromeos {
69 class ExistingUserController; 76 class ExistingUserController;
70 } 77 }
71 #endif // defined(OS_CHROMEOS) 78 #endif // defined(OS_CHROMEOS)
72 79
73 namespace IPC { 80 namespace IPC {
74 class Message; 81 class Message;
75 } 82 }
76 83
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 1301
1295 base::WeakPtr<AutomationProvider> automation_; 1302 base::WeakPtr<AutomationProvider> automation_;
1296 scoped_ptr<IPC::Message> reply_message_; 1303 scoped_ptr<IPC::Message> reply_message_;
1297 TabContentsWrapper* tab_contents_; 1304 TabContentsWrapper* tab_contents_;
1298 FilePath image_path_; 1305 FilePath image_path_;
1299 content::NotificationRegistrar registrar_; 1306 content::NotificationRegistrar registrar_;
1300 1307
1301 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker); 1308 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker);
1302 }; 1309 };
1303 1310
1311 // Processes automation mouse events and invokes a callback when processing
1312 // has completed.
1313 class AutomationMouseEventProcessor : public content::RenderViewHostObserver,
1314 public content::NotificationObserver {
1315 public:
1316 typedef base::Callback<void(const gfx::Point&)> CompletionCallback;
1317 typedef base::Callback<void(const automation::Error&)> ErrorCallback;
1318
1319 // Creates a new processor which immediately processes the given event.
1320 // Either the |completion_callback| or |error_callback| will be called
1321 // exactly once. After invoking the callback, this class will delete itself.
1322 // The |completion_callback| will be given the point at which the mouse event
1323 // occurred.
1324 AutomationMouseEventProcessor(content::RenderViewHost* render_view_host,
1325 const AutomationMouseEvent& event,
1326 const CompletionCallback& completion_callback,
1327 const ErrorCallback& error_callback);
1328 virtual ~AutomationMouseEventProcessor();
1329
1330 private:
1331 // IPC message handlers.
1332 virtual void OnWillProcessMouseEventAt(const gfx::Point& point);
1333 virtual void OnProcessMouseEventACK(
1334 bool success,
1335 const std::string& error_msg);
1336
1337 // RenderViewHostObserver overrides.
1338 virtual void RenderViewHostDestroyed(content::RenderViewHost* host) OVERRIDE;
1339 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
1340
1341 // NotificationObserver overrides.
1342 virtual void Observe(int type,
1343 const content::NotificationSource& source,
1344 const content::NotificationDetails& details) OVERRIDE;
1345
1346 // Helper method to invoke the appropriate callback. Uses the given error
1347 // only if the operation failed. Deletes this.
1348 void InvokeCallback(const automation::Error& error);
1349
1350 content::NotificationRegistrar registrar_;
1351 CompletionCallback completion_callback_;
1352 ErrorCallback error_callback_;
1353 bool has_point_;
1354 gfx::Point point_;
1355
1356 DISALLOW_COPY_AND_ASSIGN(AutomationMouseEventProcessor);
1357 };
1358
1304 class NTPInfoObserver : public content::NotificationObserver { 1359 class NTPInfoObserver : public content::NotificationObserver {
1305 public: 1360 public:
1306 NTPInfoObserver(AutomationProvider* automation, 1361 NTPInfoObserver(AutomationProvider* automation,
1307 IPC::Message* reply_message, 1362 IPC::Message* reply_message,
1308 CancelableRequestConsumer* consumer); 1363 CancelableRequestConsumer* consumer);
1309 virtual ~NTPInfoObserver(); 1364 virtual ~NTPInfoObserver();
1310 1365
1311 virtual void Observe(int type, 1366 virtual void Observe(int type,
1312 const content::NotificationSource& source, 1367 const content::NotificationSource& source,
1313 const content::NotificationDetails& details); 1368 const content::NotificationDetails& details);
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 private: 1851 private:
1797 base::WeakPtr<AutomationProvider> automation_; 1852 base::WeakPtr<AutomationProvider> automation_;
1798 scoped_ptr<IPC::Message> reply_message_; 1853 scoped_ptr<IPC::Message> reply_message_;
1799 std::string extension_id_; 1854 std::string extension_id_;
1800 content::NotificationRegistrar registrar_; 1855 content::NotificationRegistrar registrar_;
1801 1856
1802 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupObserver); 1857 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupObserver);
1803 }; 1858 };
1804 1859
1805 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ 1860 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_misc_browsertest.cc ('k') | chrome/browser/automation/automation_provider_observers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698