| Index: chrome/browser/automation/automation_event_queue.h
|
| diff --git a/chrome/browser/automation/automation_event_queue.h b/chrome/browser/automation/automation_event_queue.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..62c4ab0a21e41e49fc2ec0a1c5be0b67fe862b42
|
| --- /dev/null
|
| +++ b/chrome/browser/automation/automation_event_queue.h
|
| @@ -0,0 +1,75 @@
|
| +// Copyright (c) 2012 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_AUTOMATION_EVENT_QUEUE_H_
|
| +#define CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_QUEUE_H_
|
| +
|
| +#include <list>
|
| +#include <map>
|
| +
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "base/values.h"
|
| +
|
| +class AutomationEventObserver;
|
| +class AutomationProvider;
|
| +
|
| +namespace IPC {
|
| +class Message;
|
| +}
|
| +
|
| +// AutomationEventQueue maintains a queue of unhandled automation events.
|
| +class AutomationEventQueue {
|
| + public:
|
| + AutomationEventQueue();
|
| + virtual ~AutomationEventQueue();
|
| +
|
| + // AutomationEvent stores return data dictionay for a single event.
|
| + class AutomationEvent {
|
| + public:
|
| + AutomationEvent(int observer_id, DictionaryValue* event_value);
|
| + virtual ~AutomationEvent() {}
|
| +
|
| + void ReturnValue(AutomationProvider* automation,
|
| + IPC::Message* reply_message);
|
| + int GetId() const { return observer_id_; }
|
| + DictionaryValue* ReleaseValue() { return event_value_.release(); }
|
| +
|
| + private:
|
| + scoped_ptr<DictionaryValue> event_value_;
|
| + int observer_id_;
|
| + };
|
| +
|
| + void GetEvent(AutomationProvider* automation,
|
| + IPC::Message* reply_message,
|
| + int observer_id,
|
| + bool blocking);
|
| + void NotifyEvent(AutomationEvent* event);
|
| + void Clear();
|
| + bool IsEmpty();
|
| + AutomationEvent* PopEvent();
|
| + AutomationEvent* PopEvent(int observer_id);
|
| +
|
| + int AddObserver(AutomationEventObserver* observer);
|
| + void RemoveObserver(int observer_id);
|
| + void ClearObservers();
|
| +
|
| + private:
|
| + bool CheckReturnEvent();
|
| + void SetWait(AutomationProvider* automation,
|
| + IPC::Message* reply_message,
|
| + int observer_id);
|
| + void ClearWait();
|
| +
|
| + std::list<AutomationEvent*> event_queue_;
|
| + std::map<int, AutomationEventObserver*> observers_;
|
| + int observer_id_count_;
|
| +
|
| + AutomationProvider* wait_automation_;
|
| + scoped_ptr<IPC::Message> wait_reply_message_;
|
| + int wait_observer_id_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(AutomationEventQueue);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_QUEUE_H_
|
|
|