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 "chrome/browser/automation/automation_provider_observers.h" | 5 #include "chrome/browser/automation/automation_provider_observers.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 } | 247 } |
248 } | 248 } |
249 | 249 |
250 NavigationControllerRestoredObserver::~NavigationControllerRestoredObserver() { | 250 NavigationControllerRestoredObserver::~NavigationControllerRestoredObserver() { |
251 } | 251 } |
252 | 252 |
253 void NavigationControllerRestoredObserver::Observe( | 253 void NavigationControllerRestoredObserver::Observe( |
254 int type, const content::NotificationSource& source, | 254 int type, const content::NotificationSource& source, |
255 const content::NotificationDetails& details) { | 255 const content::NotificationDetails& details) { |
256 if (FinishedRestoring()) { | 256 if (FinishedRestoring()) { |
| 257 registrar_.RemoveAll(); |
257 SendDone(); | 258 SendDone(); |
258 registrar_.RemoveAll(); | |
259 } | 259 } |
260 } | 260 } |
261 | 261 |
262 bool NavigationControllerRestoredObserver::FinishedRestoring() { | 262 bool NavigationControllerRestoredObserver::FinishedRestoring() { |
263 return (!controller_->NeedsReload() && !controller_->GetPendingEntry() && | 263 return (!controller_->NeedsReload() && !controller_->GetPendingEntry() && |
264 !controller_->GetWebContents()->IsLoading()); | 264 !controller_->GetWebContents()->IsLoading()); |
265 } | 265 } |
266 | 266 |
267 void NavigationControllerRestoredObserver::SendDone() { | 267 void NavigationControllerRestoredObserver::SendDone() { |
268 if (!automation_) | 268 if (automation_) { |
269 return; | 269 AutomationJSONReply(automation_, reply_message_.release()) |
270 | 270 .SendSuccess(NULL); |
271 AutomationMsg_WaitForTabToBeRestored::WriteReplyParams(reply_message_.get(), | 271 } |
272 true); | 272 delete this; |
273 automation_->Send(reply_message_.release()); | |
274 } | 273 } |
275 | 274 |
276 NavigationNotificationObserver::NavigationNotificationObserver( | 275 NavigationNotificationObserver::NavigationNotificationObserver( |
277 NavigationController* controller, | 276 NavigationController* controller, |
278 AutomationProvider* automation, | 277 AutomationProvider* automation, |
279 IPC::Message* reply_message, | 278 IPC::Message* reply_message, |
280 int number_of_navigations, | 279 int number_of_navigations, |
281 bool include_current_navigation, | 280 bool include_current_navigation, |
282 bool use_json_interface) | 281 bool use_json_interface) |
283 : automation_(automation->AsWeakPtr()), | 282 : automation_(automation->AsWeakPtr()), |
(...skipping 2873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3157 if (automation_) { | 3156 if (automation_) { |
3158 AutomationJSONReply(automation_, reply_message_.release()) | 3157 AutomationJSONReply(automation_, reply_message_.release()) |
3159 .SendSuccess(NULL); | 3158 .SendSuccess(NULL); |
3160 } | 3159 } |
3161 delete this; | 3160 delete this; |
3162 } | 3161 } |
3163 } else { | 3162 } else { |
3164 NOTREACHED(); | 3163 NOTREACHED(); |
3165 } | 3164 } |
3166 } | 3165 } |
OLD | NEW |