| 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 4241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4252 const BalloonCollection::Balloons& balloons = collection->GetActiveBalloons(); | 4252 const BalloonCollection::Balloons& balloons = collection->GetActiveBalloons(); |
| 4253 int balloon_count = static_cast<int>(balloons.size()); | 4253 int balloon_count = static_cast<int>(balloons.size()); |
| 4254 if (index < 0 || index >= balloon_count) { | 4254 if (index < 0 || index >= balloon_count) { |
| 4255 AutomationJSONReply(this, reply_message).SendError( | 4255 AutomationJSONReply(this, reply_message).SendError( |
| 4256 StringPrintf("No notification at index %d", index)); | 4256 StringPrintf("No notification at index %d", index)); |
| 4257 return; | 4257 return; |
| 4258 } | 4258 } |
| 4259 // This will delete itself when finished. | 4259 // This will delete itself when finished. |
| 4260 new OnNotificationBalloonCountObserver( | 4260 new OnNotificationBalloonCountObserver( |
| 4261 this, reply_message, collection, balloon_count - 1); | 4261 this, reply_message, collection, balloon_count - 1); |
| 4262 manager->Cancel(balloons[index]->notification()); | 4262 manager->CancelById(balloons[index]->notification().notification_id()); |
| 4263 } | 4263 } |
| 4264 | 4264 |
| 4265 // Refer to WaitForNotificationCount() in chrome/test/pyautolib/pyauto.py for | 4265 // Refer to WaitForNotificationCount() in chrome/test/pyautolib/pyauto.py for |
| 4266 // sample json input. | 4266 // sample json input. |
| 4267 // Returns empty json message. | 4267 // Returns empty json message. |
| 4268 void TestingAutomationProvider::WaitForNotificationCount( | 4268 void TestingAutomationProvider::WaitForNotificationCount( |
| 4269 Browser* browser, | 4269 Browser* browser, |
| 4270 DictionaryValue* args, | 4270 DictionaryValue* args, |
| 4271 IPC::Message* reply_message) { | 4271 IPC::Message* reply_message) { |
| 4272 int count; | 4272 int count; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4435 DCHECK(type == NotificationType::SESSION_END); | 4435 DCHECK(type == NotificationType::SESSION_END); |
| 4436 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit | 4436 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit |
| 4437 // before the task runs resulting in this object not being deleted. This | 4437 // before the task runs resulting in this object not being deleted. This |
| 4438 // Release balance out the Release scheduled by OnBrowserRemoved. | 4438 // Release balance out the Release scheduled by OnBrowserRemoved. |
| 4439 Release(); | 4439 Release(); |
| 4440 } | 4440 } |
| 4441 | 4441 |
| 4442 void TestingAutomationProvider::OnRemoveProvider() { | 4442 void TestingAutomationProvider::OnRemoveProvider() { |
| 4443 AutomationProviderList::GetInstance()->RemoveProvider(this); | 4443 AutomationProviderList::GetInstance()->RemoveProvider(this); |
| 4444 } | 4444 } |
| OLD | NEW |