| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
| 6 | 6 |
| 7 #include "app/message_box_flags.h" | 7 #include "app/message_box_flags.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 4266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4277 const BalloonCollection::Balloons& balloons = collection->GetActiveBalloons(); | 4277 const BalloonCollection::Balloons& balloons = collection->GetActiveBalloons(); |
| 4278 int balloon_count = static_cast<int>(balloons.size()); | 4278 int balloon_count = static_cast<int>(balloons.size()); |
| 4279 if (index < 0 || index >= balloon_count) { | 4279 if (index < 0 || index >= balloon_count) { |
| 4280 AutomationJSONReply(this, reply_message).SendError( | 4280 AutomationJSONReply(this, reply_message).SendError( |
| 4281 StringPrintf("No notification at index %d", index)); | 4281 StringPrintf("No notification at index %d", index)); |
| 4282 return; | 4282 return; |
| 4283 } | 4283 } |
| 4284 // This will delete itself when finished. | 4284 // This will delete itself when finished. |
| 4285 new OnNotificationBalloonCountObserver( | 4285 new OnNotificationBalloonCountObserver( |
| 4286 this, reply_message, collection, balloon_count - 1); | 4286 this, reply_message, collection, balloon_count - 1); |
| 4287 manager->Cancel(balloons[index]->notification()); | 4287 manager->CancelById(balloons[index]->notification().notification_id()); |
| 4288 } | 4288 } |
| 4289 | 4289 |
| 4290 // Refer to WaitForNotificationCount() in chrome/test/pyautolib/pyauto.py for | 4290 // Refer to WaitForNotificationCount() in chrome/test/pyautolib/pyauto.py for |
| 4291 // sample json input. | 4291 // sample json input. |
| 4292 // Returns empty json message. | 4292 // Returns empty json message. |
| 4293 void TestingAutomationProvider::WaitForNotificationCount( | 4293 void TestingAutomationProvider::WaitForNotificationCount( |
| 4294 Browser* browser, | 4294 Browser* browser, |
| 4295 DictionaryValue* args, | 4295 DictionaryValue* args, |
| 4296 IPC::Message* reply_message) { | 4296 IPC::Message* reply_message) { |
| 4297 int count; | 4297 int count; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4460 DCHECK(type == NotificationType::SESSION_END); | 4460 DCHECK(type == NotificationType::SESSION_END); |
| 4461 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit | 4461 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit |
| 4462 // before the task runs resulting in this object not being deleted. This | 4462 // before the task runs resulting in this object not being deleted. This |
| 4463 // Release balance out the Release scheduled by OnBrowserRemoved. | 4463 // Release balance out the Release scheduled by OnBrowserRemoved. |
| 4464 Release(); | 4464 Release(); |
| 4465 } | 4465 } |
| 4466 | 4466 |
| 4467 void TestingAutomationProvider::OnRemoveProvider() { | 4467 void TestingAutomationProvider::OnRemoveProvider() { |
| 4468 AutomationProviderList::GetInstance()->RemoveProvider(this); | 4468 AutomationProviderList::GetInstance()->RemoveProvider(this); |
| 4469 } | 4469 } |
| OLD | NEW |