// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ #define CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ #pragma once #include "base/basictypes.h" #include "chrome/browser/automation/automation_provider.h" #include "chrome/browser/browser_list.h" #include "chrome/common/notification_registrar.h" // This is an automation provider containing testing calls. class TestingAutomationProvider : public AutomationProvider, public BrowserList::Observer, public NotificationObserver { public: explicit TestingAutomationProvider(Profile* profile); // BrowserList::Observer implementation // Called immediately after a browser is added to the list virtual void OnBrowserAdded(const Browser* browser); // Called immediately before a browser is removed from the list virtual void OnBrowserRemoving(const Browser* browser); // IPC implementations virtual void OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError(); private: virtual ~TestingAutomationProvider(); // IPC Message callbacks. void CloseBrowser(int handle, IPC::Message* reply_message); void CloseBrowserAsync(int browser_handle); void ActivateTab(int handle, int at_index, int* status); void AppendTab(int handle, const GURL& url, IPC::Message* reply_message); virtual void Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details); void OnRemoveProvider(); // Called via PostTask NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(TestingAutomationProvider); }; #endif // CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_