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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 } else { | 390 } else { |
391 ObserveTab(content::Source<NavigationController>(source).ptr()); | 391 ObserveTab(content::Source<NavigationController>(source).ptr()); |
392 } | 392 } |
393 delete this; | 393 delete this; |
394 } else { | 394 } else { |
395 NOTREACHED(); | 395 NOTREACHED(); |
396 } | 396 } |
397 } | 397 } |
398 | 398 |
399 TabAppendedNotificationObserver::TabAppendedNotificationObserver( | 399 TabAppendedNotificationObserver::TabAppendedNotificationObserver( |
400 Browser* parent, AutomationProvider* automation, | 400 Browser* parent, |
401 IPC::Message* reply_message) | 401 AutomationProvider* automation, |
| 402 IPC::Message* reply_message, |
| 403 bool use_json_interface) |
402 : TabStripNotificationObserver(chrome::NOTIFICATION_TAB_PARENTED, | 404 : TabStripNotificationObserver(chrome::NOTIFICATION_TAB_PARENTED, |
403 automation), | 405 automation), |
404 parent_(parent), | 406 parent_(parent), |
405 reply_message_(reply_message) { | 407 reply_message_(reply_message), |
| 408 use_json_interface_(use_json_interface) { |
406 } | 409 } |
407 | 410 |
408 TabAppendedNotificationObserver::~TabAppendedNotificationObserver() {} | 411 TabAppendedNotificationObserver::~TabAppendedNotificationObserver() {} |
409 | 412 |
410 void TabAppendedNotificationObserver::ObserveTab( | 413 void TabAppendedNotificationObserver::ObserveTab( |
411 NavigationController* controller) { | 414 NavigationController* controller) { |
412 if (!automation_) | 415 if (!automation_ || !reply_message_.get()) |
413 return; | 416 return; |
414 | 417 |
415 if (automation_->GetIndexForNavigationController(controller, parent_) == | 418 if (automation_->GetIndexForNavigationController(controller, parent_) == |
416 TabStripModel::kNoTab) { | 419 TabStripModel::kNoTab) { |
417 // This tab notification doesn't belong to the parent_. | 420 // This tab notification doesn't belong to the parent_. |
418 return; | 421 return; |
419 } | 422 } |
420 | 423 |
421 new NavigationNotificationObserver(controller, automation_, | 424 new NavigationNotificationObserver(controller, automation_, |
422 reply_message_.release(), | 425 reply_message_.release(), |
423 1, false, false); | 426 1, false, use_json_interface_); |
| 427 } |
| 428 |
| 429 IPC::Message* TabAppendedNotificationObserver::ReleaseReply() { |
| 430 return reply_message_.release(); |
424 } | 431 } |
425 | 432 |
426 TabClosedNotificationObserver::TabClosedNotificationObserver( | 433 TabClosedNotificationObserver::TabClosedNotificationObserver( |
427 AutomationProvider* automation, bool wait_until_closed, | 434 AutomationProvider* automation, bool wait_until_closed, |
428 IPC::Message* reply_message) | 435 IPC::Message* reply_message) |
429 : TabStripNotificationObserver( | 436 : TabStripNotificationObserver( |
430 wait_until_closed | 437 wait_until_closed |
431 ? static_cast<int>(content::NOTIFICATION_WEB_CONTENTS_DESTROYED) | 438 ? static_cast<int>(content::NOTIFICATION_WEB_CONTENTS_DESTROYED) |
432 : static_cast<int>(chrome::NOTIFICATION_TAB_CLOSING), | 439 : static_cast<int>(chrome::NOTIFICATION_TAB_CLOSING), |
433 automation), | 440 automation), |
(...skipping 2659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3093 if (automation_) { | 3100 if (automation_) { |
3094 AutomationJSONReply(automation_, reply_message_.release()) | 3101 AutomationJSONReply(automation_, reply_message_.release()) |
3095 .SendSuccess(NULL); | 3102 .SendSuccess(NULL); |
3096 } | 3103 } |
3097 delete this; | 3104 delete this; |
3098 } | 3105 } |
3099 } else { | 3106 } else { |
3100 NOTREACHED(); | 3107 NOTREACHED(); |
3101 } | 3108 } |
3102 } | 3109 } |
3103 | |
OLD | NEW |