| 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 | 378 |
| 379 TabStripNotificationObserver::~TabStripNotificationObserver() { | 379 TabStripNotificationObserver::~TabStripNotificationObserver() { |
| 380 } | 380 } |
| 381 | 381 |
| 382 void TabStripNotificationObserver::Observe( | 382 void TabStripNotificationObserver::Observe( |
| 383 int type, | 383 int type, |
| 384 const content::NotificationSource& source, | 384 const content::NotificationSource& source, |
| 385 const content::NotificationDetails& details) { | 385 const content::NotificationDetails& details) { |
| 386 DCHECK_EQ(notification_, type); | 386 DCHECK_EQ(notification_, type); |
| 387 if (type == chrome::NOTIFICATION_TAB_PARENTED) { | 387 if (type == chrome::NOTIFICATION_TAB_PARENTED) { |
| 388 ObserveTab(&content::Source<TabContents>(source)->web_contents()-> | 388 ObserveTab(&content::Source<content::WebContents>(source)->GetController()); |
| 389 GetController()); | |
| 390 } else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 389 } else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
| 391 ObserveTab(&content::Source<content::WebContents>(source)->GetController()); | 390 ObserveTab(&content::Source<content::WebContents>(source)->GetController()); |
| 392 } else { | 391 } else { |
| 393 ObserveTab(content::Source<NavigationController>(source).ptr()); | 392 ObserveTab(content::Source<NavigationController>(source).ptr()); |
| 394 } | 393 } |
| 395 delete this; | 394 delete this; |
| 396 } | 395 } |
| 397 | 396 |
| 398 TabAppendedNotificationObserver::TabAppendedNotificationObserver( | 397 TabAppendedNotificationObserver::TabAppendedNotificationObserver( |
| 399 Browser* parent, | 398 Browser* parent, |
| (...skipping 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2437 registrar_.Add(this, | 2436 registrar_.Add(this, |
| 2438 chrome::NOTIFICATION_TAB_PARENTED, | 2437 chrome::NOTIFICATION_TAB_PARENTED, |
| 2439 content::NotificationService::AllSources()); | 2438 content::NotificationService::AllSources()); |
| 2440 } | 2439 } |
| 2441 | 2440 |
| 2442 void NewTabObserver::Observe(int type, | 2441 void NewTabObserver::Observe(int type, |
| 2443 const content::NotificationSource& source, | 2442 const content::NotificationSource& source, |
| 2444 const content::NotificationDetails& details) { | 2443 const content::NotificationDetails& details) { |
| 2445 DCHECK_EQ(chrome::NOTIFICATION_TAB_PARENTED, type); | 2444 DCHECK_EQ(chrome::NOTIFICATION_TAB_PARENTED, type); |
| 2446 NavigationController* controller = | 2445 NavigationController* controller = |
| 2447 &(content::Source<TabContents>(source).ptr()-> | 2446 &(content::Source<content::WebContents>(source).ptr()->GetController()); |
| 2448 web_contents()->GetController()); | |
| 2449 if (automation_) { | 2447 if (automation_) { |
| 2450 // TODO(phajdan.jr): Clean up this hack. We write the correct return type | 2448 // TODO(phajdan.jr): Clean up this hack. We write the correct return type |
| 2451 // here, but don't send the message. NavigationNotificationObserver | 2449 // here, but don't send the message. NavigationNotificationObserver |
| 2452 // will wait properly for the load to finish, and send the message, | 2450 // will wait properly for the load to finish, and send the message, |
| 2453 // but it will also append its own return value at the end of the reply. | 2451 // but it will also append its own return value at the end of the reply. |
| 2454 if (!use_json_interface_) | 2452 if (!use_json_interface_) |
| 2455 AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message_.get(), | 2453 AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message_.get(), |
| 2456 true); | 2454 true); |
| 2457 new NavigationNotificationObserver(controller, automation_, | 2455 new NavigationNotificationObserver(controller, automation_, |
| 2458 reply_message_.release(), | 2456 reply_message_.release(), |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2876 if (automation_) { | 2874 if (automation_) { |
| 2877 AutomationJSONReply(automation_, reply_message_.release()) | 2875 AutomationJSONReply(automation_, reply_message_.release()) |
| 2878 .SendSuccess(NULL); | 2876 .SendSuccess(NULL); |
| 2879 } | 2877 } |
| 2880 delete this; | 2878 delete this; |
| 2881 } | 2879 } |
| 2882 } else { | 2880 } else { |
| 2883 NOTREACHED(); | 2881 NOTREACHED(); |
| 2884 } | 2882 } |
| 2885 } | 2883 } |
| OLD | NEW |