| 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 #include <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "chrome/browser/automation/automation_event_observers.h" | 9 #include "chrome/browser/automation/automation_event_observers.h" |
| 10 #include "chrome/browser/automation/automation_event_queue.h" | 10 #include "chrome/browser/automation/automation_event_queue.h" |
| 11 #include "chrome/browser/automation/automation_provider_json.h" | 11 #include "chrome/browser/automation/automation_provider_json.h" |
| 12 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
| 13 #include "content/public/browser/notification_types.h" | 13 #include "content/public/browser/notification_types.h" |
| 14 | 14 |
| 15 AutomationEventQueue::CompareObserverId::CompareObserverId(int id) : id_(id) {} | 15 AutomationEventQueue::CompareObserverId::CompareObserverId(int id) : id_(id) {} |
| 16 | 16 |
| 17 bool AutomationEventQueue::CompareObserverId::operator()( | 17 bool AutomationEventQueue::CompareObserverId::operator()( |
| 18 AutomationEvent* event) const { | 18 AutomationEvent* event) const { |
| 19 return event->GetId() < 0 || event->GetId() == id_; | 19 return event->GetId() < 0 || event->GetId() == id_; |
| 20 } | 20 } |
| 21 | 21 |
| 22 AutomationEventQueue::AutomationEventQueue() | 22 AutomationEventQueue::AutomationEventQueue() |
| 23 : observer_id_count_(0), | 23 : observer_id_count_(0), wait_observer_id_(-1) {} |
| 24 wait_automation_reply_(NULL), | |
| 25 wait_observer_id_(-1) {} | |
| 26 | 24 |
| 27 AutomationEventQueue::~AutomationEventQueue() { | 25 AutomationEventQueue::~AutomationEventQueue() { |
| 28 Clear(); | 26 Clear(); |
| 29 } | 27 } |
| 30 | 28 |
| 31 AutomationEventQueue::AutomationEvent::AutomationEvent( | 29 AutomationEventQueue::AutomationEvent::AutomationEvent( |
| 32 int observer_id, DictionaryValue* event_value) | 30 int observer_id, DictionaryValue* event_value) |
| 33 : observer_id_(observer_id), event_value_(event_value) {} | 31 : observer_id_(observer_id), event_value_(event_value) {} |
| 34 | 32 |
| 35 void AutomationEventQueue::GetNextEvent(AutomationJSONReply* reply, | 33 void AutomationEventQueue::GetNextEvent(AutomationJSONReply* reply, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if (event) { | 113 if (event) { |
| 116 wait_automation_reply_->SendSuccess(event->GetValue()); | 114 wait_automation_reply_->SendSuccess(event->GetValue()); |
| 117 wait_automation_reply_.reset(); | 115 wait_automation_reply_.reset(); |
| 118 wait_observer_id_ = -1; | 116 wait_observer_id_ = -1; |
| 119 delete event; | 117 delete event; |
| 120 return true; | 118 return true; |
| 121 } | 119 } |
| 122 } | 120 } |
| 123 return false; | 121 return false; |
| 124 } | 122 } |
| OLD | NEW |