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

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

Issue 10855253: Convert the autofill pyauto tests to browser tests, and remove all the supporting automation hooks … (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 8 years, 4 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 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 content::NavigationController* controller_; 1480 content::NavigationController* controller_;
1481 base::WeakPtr<AutomationProvider> automation_; 1481 base::WeakPtr<AutomationProvider> automation_;
1482 scoped_ptr<IPC::Message> reply_message_; 1482 scoped_ptr<IPC::Message> reply_message_;
1483 content::NotificationRegistrar registrar_; 1483 content::NotificationRegistrar registrar_;
1484 extension_misc::LaunchContainer launch_container_; 1484 extension_misc::LaunchContainer launch_container_;
1485 int new_window_id_; 1485 int new_window_id_;
1486 1486
1487 DISALLOW_COPY_AND_ASSIGN(AppLaunchObserver); 1487 DISALLOW_COPY_AND_ASSIGN(AppLaunchObserver);
1488 }; 1488 };
1489 1489
1490 // Observes when Autofill information is displayed in the renderer. This can
1491 // happen in two different ways: (1) a popup containing Autofill suggestions
1492 // has been shown in the renderer; (2) a webpage form is filled or previewed
1493 // with Autofill suggestions. A constructor argument specifies the appropriate
1494 // notification to wait for.
1495 class AutofillDisplayedObserver : public content::NotificationObserver {
1496 public:
1497 AutofillDisplayedObserver(int notification,
1498 content::RenderViewHost* render_view_host,
1499 AutomationProvider* automation,
1500 IPC::Message* reply_message);
1501 virtual ~AutofillDisplayedObserver();
1502
1503 // Overridden from content::NotificationObserver:
1504 virtual void Observe(int type,
1505 const content::NotificationSource& source,
1506 const content::NotificationDetails& details) OVERRIDE;
1507
1508 private:
1509 int notification_;
1510 content::RenderViewHost* render_view_host_;
1511 base::WeakPtr<AutomationProvider> automation_;
1512 scoped_ptr<IPC::Message> reply_message_;
1513 content::NotificationRegistrar registrar_;
1514
1515 DISALLOW_COPY_AND_ASSIGN(AutofillDisplayedObserver);
1516 };
1517
1518 // Observes when a specified number of autofill profiles and credit cards have
1519 // been changed in the WebDataService. The notifications are sent on the DB
1520 // thread, the thread that interacts with the database.
1521 class AutofillChangedObserver
1522 : public base::RefCountedThreadSafe<
1523 AutofillChangedObserver,
1524 content::BrowserThread::DeleteOnUIThread>,
1525 public content::NotificationObserver {
1526 public:
1527 AutofillChangedObserver(AutomationProvider* automation,
1528 IPC::Message* reply_message,
1529 int num_profiles,
1530 int num_credit_cards);
1531
1532 // Schedules a task on the DB thread to register the appropriate observers.
1533 virtual void Init();
1534
1535 // Overridden from content::NotificationObserver:
1536 virtual void Observe(int type,
1537 const content::NotificationSource& source,
1538 const content::NotificationDetails& details) OVERRIDE;
1539
1540 private:
1541 friend struct content::BrowserThread::DeleteOnThread<
1542 content::BrowserThread::UI>;
1543 ~AutofillChangedObserver();
1544 friend class base::DeleteHelper<AutofillChangedObserver>;
1545
1546 // Registers the appropriate observers. Called on the DB thread.
1547 void RegisterObserversTask();
1548
1549 // Sends the |reply_message_| to |automation_| indicating we're done. Called
1550 // on the UI thread.
1551 void IndicateDone();
1552
1553 base::WeakPtr<AutomationProvider> automation_;
1554 scoped_ptr<IPC::Message> reply_message_;
1555 scoped_ptr<content::NotificationRegistrar> registrar_;
1556 int num_profiles_;
1557 int num_credit_cards_;
1558
1559 // Used to ensure that the UI thread waits for the DB thread to finish
1560 // registering observers before proceeding.
1561 base::WaitableEvent done_event_;
1562
1563 DISALLOW_COPY_AND_ASSIGN(AutofillChangedObserver);
1564 };
1565
1566 // Observes when an Autofill form submitted via a webpage has been processed.
1567 // This observer also takes care of accepting any infobars that appear as a
1568 // result of submitting the webpage form (submitting credit card information
1569 // causes a confirm infobar to appear).
1570 class AutofillFormSubmittedObserver
1571 : public PersonalDataManagerObserver,
1572 public content::NotificationObserver {
1573 public:
1574 AutofillFormSubmittedObserver(AutomationProvider* automation,
1575 IPC::Message* reply_message,
1576 PersonalDataManager* pdm);
1577 virtual ~AutofillFormSubmittedObserver();
1578
1579 // PersonalDataManagerObserver interface.
1580 virtual void OnPersonalDataChanged() OVERRIDE;
1581 virtual void OnInsufficientFormData() OVERRIDE;
1582
1583 // Overridden from content::NotificationObserver:
1584 virtual void Observe(int type,
1585 const content::NotificationSource& source,
1586 const content::NotificationDetails& details) OVERRIDE;
1587
1588 private:
1589 content::NotificationRegistrar registrar_;
1590 base::WeakPtr<AutomationProvider> automation_;
1591 scoped_ptr<IPC::Message> reply_message_;
1592 PersonalDataManager* pdm_;
1593 InfoBarTabHelper* infobar_helper_;
1594 };
1595
1596 // Allows the automation provider to wait until all the notification 1490 // Allows the automation provider to wait until all the notification
1597 // processes are ready. 1491 // processes are ready.
1598 class GetAllNotificationsObserver : public content::NotificationObserver { 1492 class GetAllNotificationsObserver : public content::NotificationObserver {
1599 public: 1493 public:
1600 GetAllNotificationsObserver(AutomationProvider* automation, 1494 GetAllNotificationsObserver(AutomationProvider* automation,
1601 IPC::Message* reply_message); 1495 IPC::Message* reply_message);
1602 virtual ~GetAllNotificationsObserver(); 1496 virtual ~GetAllNotificationsObserver();
1603 1497
1604 // Overridden from content::NotificationObserver: 1498 // Overridden from content::NotificationObserver:
1605 virtual void Observe(int type, 1499 virtual void Observe(int type,
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 base::WeakPtr<AutomationProvider> automation_; 1887 base::WeakPtr<AutomationProvider> automation_;
1994 scoped_ptr<IPC::Message> reply_message_; 1888 scoped_ptr<IPC::Message> reply_message_;
1995 int new_window_id_; 1889 int new_window_id_;
1996 int num_loads_; 1890 int num_loads_;
1997 1891
1998 DISALLOW_COPY_AND_ASSIGN( 1892 DISALLOW_COPY_AND_ASSIGN(
1999 BrowserOpenedWithExistingProfileNotificationObserver); 1893 BrowserOpenedWithExistingProfileNotificationObserver);
2000 }; 1894 };
2001 1895
2002 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ 1896 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_
OLDNEW
« no previous file with comments | « chrome/browser/autofill/personal_data_manager.h ('k') | chrome/browser/automation/automation_provider_observers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698