OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 382 |
383 TabStripNotificationObserver::~TabStripNotificationObserver() { | 383 TabStripNotificationObserver::~TabStripNotificationObserver() { |
384 } | 384 } |
385 | 385 |
386 void TabStripNotificationObserver::Observe( | 386 void TabStripNotificationObserver::Observe( |
387 int type, | 387 int type, |
388 const content::NotificationSource& source, | 388 const content::NotificationSource& source, |
389 const content::NotificationDetails& details) { | 389 const content::NotificationDetails& details) { |
390 if (type == notification_) { | 390 if (type == notification_) { |
391 if (type == content::NOTIFICATION_TAB_PARENTED) { | 391 if (type == content::NOTIFICATION_TAB_PARENTED) { |
392 ObserveTab( | 392 ObserveTab(&(content::Source<TabContentsWrapper>(source).ptr()-> |
393 &(content::Source<TabContentsWrapper>(source).ptr()->controller())); | 393 tab_contents()->controller())); |
394 } else { | 394 } else { |
395 ObserveTab(content::Source<NavigationController>(source).ptr()); | 395 ObserveTab(content::Source<NavigationController>(source).ptr()); |
396 } | 396 } |
397 delete this; | 397 delete this; |
398 } else { | 398 } else { |
399 NOTREACHED(); | 399 NOTREACHED(); |
400 } | 400 } |
401 } | 401 } |
402 | 402 |
403 TabAppendedNotificationObserver::TabAppendedNotificationObserver( | 403 TabAppendedNotificationObserver::TabAppendedNotificationObserver( |
(...skipping 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2741 registrar_.Add(this, | 2741 registrar_.Add(this, |
2742 content::NOTIFICATION_TAB_PARENTED, | 2742 content::NOTIFICATION_TAB_PARENTED, |
2743 content::NotificationService::AllSources()); | 2743 content::NotificationService::AllSources()); |
2744 } | 2744 } |
2745 | 2745 |
2746 void NewTabObserver::Observe(int type, | 2746 void NewTabObserver::Observe(int type, |
2747 const content::NotificationSource& source, | 2747 const content::NotificationSource& source, |
2748 const content::NotificationDetails& details) { | 2748 const content::NotificationDetails& details) { |
2749 DCHECK_EQ(content::NOTIFICATION_TAB_PARENTED, type); | 2749 DCHECK_EQ(content::NOTIFICATION_TAB_PARENTED, type); |
2750 NavigationController* controller = | 2750 NavigationController* controller = |
2751 &(content::Source<TabContentsWrapper>(source).ptr()->controller()); | 2751 &(content::Source<TabContentsWrapper>(source).ptr()-> |
| 2752 tab_contents()->controller()); |
2752 if (automation_) { | 2753 if (automation_) { |
2753 // TODO(phajdan.jr): Clean up this hack. We write the correct return type | 2754 // TODO(phajdan.jr): Clean up this hack. We write the correct return type |
2754 // here, but don't send the message. NavigationNotificationObserver | 2755 // here, but don't send the message. NavigationNotificationObserver |
2755 // will wait properly for the load to finish, and send the message, | 2756 // will wait properly for the load to finish, and send the message, |
2756 // but it will also append its own return value at the end of the reply. | 2757 // but it will also append its own return value at the end of the reply. |
2757 AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message_.get(), | 2758 AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message_.get(), |
2758 true); | 2759 true); |
2759 new NavigationNotificationObserver(controller, automation_, | 2760 new NavigationNotificationObserver(controller, automation_, |
2760 reply_message_.release(), | 2761 reply_message_.release(), |
2761 1, false, false); | 2762 1, false, false); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3092 } | 3093 } |
3093 | 3094 |
3094 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); | 3095 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); |
3095 if (host->extension_id() == extension_id_ && | 3096 if (host->extension_id() == extension_id_ && |
3096 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) { | 3097 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) { |
3097 AutomationJSONReply(automation_, reply_message_.release()) | 3098 AutomationJSONReply(automation_, reply_message_.release()) |
3098 .SendSuccess(NULL); | 3099 .SendSuccess(NULL); |
3099 delete this; | 3100 delete this; |
3100 } | 3101 } |
3101 } | 3102 } |
OLD | NEW |