| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" | 69 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" |
| 70 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 70 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 71 #include "chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.h" | 71 #include "chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.h" |
| 72 #include "chrome/common/automation_messages.h" | 72 #include "chrome/common/automation_messages.h" |
| 73 #include "chrome/common/chrome_notification_types.h" | 73 #include "chrome/common/chrome_notification_types.h" |
| 74 #include "chrome/common/chrome_view_type.h" | 74 #include "chrome/common/chrome_view_type.h" |
| 75 #include "chrome/common/content_settings_types.h" | 75 #include "chrome/common/content_settings_types.h" |
| 76 #include "chrome/common/extensions/extension.h" | 76 #include "chrome/common/extensions/extension.h" |
| 77 #include "content/browser/download/save_package.h" | 77 #include "content/browser/download/save_package.h" |
| 78 #include "content/browser/renderer_host/render_view_host.h" | 78 #include "content/browser/renderer_host/render_view_host.h" |
| 79 #include "content/browser/tab_contents/tab_contents.h" | |
| 80 #include "content/public/browser/navigation_controller.h" | 79 #include "content/public/browser/navigation_controller.h" |
| 81 #include "content/public/browser/notification_service.h" | 80 #include "content/public/browser/notification_service.h" |
| 82 #include "content/public/browser/render_process_host.h" | 81 #include "content/public/browser/render_process_host.h" |
| 82 #include "content/public/browser/web_contents.h" |
| 83 #include "content/public/common/process_type.h" | 83 #include "content/public/common/process_type.h" |
| 84 #include "googleurl/src/gurl.h" | 84 #include "googleurl/src/gurl.h" |
| 85 #include "third_party/skia/include/core/SkBitmap.h" | 85 #include "third_party/skia/include/core/SkBitmap.h" |
| 86 #include "ui/gfx/codec/png_codec.h" | 86 #include "ui/gfx/codec/png_codec.h" |
| 87 #include "ui/gfx/rect.h" | 87 #include "ui/gfx/rect.h" |
| 88 | 88 |
| 89 using content::BrowserThread; | 89 using content::BrowserThread; |
| 90 using content::DownloadItem; | 90 using content::DownloadItem; |
| 91 using content::DownloadManager; | 91 using content::DownloadManager; |
| 92 using content::NavigationController; | 92 using content::NavigationController; |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 TabStripNotificationObserver::~TabStripNotificationObserver() { | 387 TabStripNotificationObserver::~TabStripNotificationObserver() { |
| 388 } | 388 } |
| 389 | 389 |
| 390 void TabStripNotificationObserver::Observe( | 390 void TabStripNotificationObserver::Observe( |
| 391 int type, | 391 int type, |
| 392 const content::NotificationSource& source, | 392 const content::NotificationSource& source, |
| 393 const content::NotificationDetails& details) { | 393 const content::NotificationDetails& details) { |
| 394 if (type == notification_) { | 394 if (type == notification_) { |
| 395 if (type == content::NOTIFICATION_TAB_PARENTED) { | 395 if (type == content::NOTIFICATION_TAB_PARENTED) { |
| 396 ObserveTab(&(content::Source<TabContentsWrapper>(source).ptr()-> | 396 ObserveTab(&(content::Source<TabContentsWrapper>(source).ptr()-> |
| 397 tab_contents()->GetController())); | 397 web_contents()->GetController())); |
| 398 } else { | 398 } else { |
| 399 ObserveTab(content::Source<NavigationController>(source).ptr()); | 399 ObserveTab(content::Source<NavigationController>(source).ptr()); |
| 400 } | 400 } |
| 401 delete this; | 401 delete this; |
| 402 } else { | 402 } else { |
| 403 NOTREACHED(); | 403 NOTREACHED(); |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 | 406 |
| 407 TabAppendedNotificationObserver::TabAppendedNotificationObserver( | 407 TabAppendedNotificationObserver::TabAppendedNotificationObserver( |
| (...skipping 2260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2668 content::NotificationService::AllSources()); | 2668 content::NotificationService::AllSources()); |
| 2669 for (BrowserList::const_iterator iter = BrowserList::begin(); | 2669 for (BrowserList::const_iterator iter = BrowserList::begin(); |
| 2670 iter != BrowserList::end(); | 2670 iter != BrowserList::end(); |
| 2671 ++iter) { | 2671 ++iter) { |
| 2672 Browser* browser = *iter; | 2672 Browser* browser = *iter; |
| 2673 for (int i = 0; i < browser->tab_count(); ++i) { | 2673 for (int i = 0; i < browser->tab_count(); ++i) { |
| 2674 TabContentsWrapper* contents_wrapper = | 2674 TabContentsWrapper* contents_wrapper = |
| 2675 browser->GetTabContentsWrapperAt(i); | 2675 browser->GetTabContentsWrapperAt(i); |
| 2676 StartObserving(contents_wrapper->automation_tab_helper()); | 2676 StartObserving(contents_wrapper->automation_tab_helper()); |
| 2677 if (contents_wrapper->automation_tab_helper()->has_pending_loads()) | 2677 if (contents_wrapper->automation_tab_helper()->has_pending_loads()) |
| 2678 pending_tabs_.insert(contents_wrapper->tab_contents()); | 2678 pending_tabs_.insert(contents_wrapper->web_contents()); |
| 2679 } | 2679 } |
| 2680 } | 2680 } |
| 2681 CheckIfNoMorePendingLoads(); | 2681 CheckIfNoMorePendingLoads(); |
| 2682 } | 2682 } |
| 2683 | 2683 |
| 2684 AllViewsStoppedLoadingObserver::~AllViewsStoppedLoadingObserver() { | 2684 AllViewsStoppedLoadingObserver::~AllViewsStoppedLoadingObserver() { |
| 2685 } | 2685 } |
| 2686 | 2686 |
| 2687 void AllViewsStoppedLoadingObserver::OnFirstPendingLoad( | 2687 void AllViewsStoppedLoadingObserver::OnFirstPendingLoad( |
| 2688 content::WebContents* web_contents) { | 2688 content::WebContents* web_contents) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2746 content::NOTIFICATION_TAB_PARENTED, | 2746 content::NOTIFICATION_TAB_PARENTED, |
| 2747 content::NotificationService::AllSources()); | 2747 content::NotificationService::AllSources()); |
| 2748 } | 2748 } |
| 2749 | 2749 |
| 2750 void NewTabObserver::Observe(int type, | 2750 void NewTabObserver::Observe(int type, |
| 2751 const content::NotificationSource& source, | 2751 const content::NotificationSource& source, |
| 2752 const content::NotificationDetails& details) { | 2752 const content::NotificationDetails& details) { |
| 2753 DCHECK_EQ(content::NOTIFICATION_TAB_PARENTED, type); | 2753 DCHECK_EQ(content::NOTIFICATION_TAB_PARENTED, type); |
| 2754 NavigationController* controller = | 2754 NavigationController* controller = |
| 2755 &(content::Source<TabContentsWrapper>(source).ptr()-> | 2755 &(content::Source<TabContentsWrapper>(source).ptr()-> |
| 2756 tab_contents()->GetController()); | 2756 web_contents()->GetController()); |
| 2757 if (automation_) { | 2757 if (automation_) { |
| 2758 // TODO(phajdan.jr): Clean up this hack. We write the correct return type | 2758 // TODO(phajdan.jr): Clean up this hack. We write the correct return type |
| 2759 // here, but don't send the message. NavigationNotificationObserver | 2759 // here, but don't send the message. NavigationNotificationObserver |
| 2760 // will wait properly for the load to finish, and send the message, | 2760 // will wait properly for the load to finish, and send the message, |
| 2761 // but it will also append its own return value at the end of the reply. | 2761 // but it will also append its own return value at the end of the reply. |
| 2762 AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message_.get(), | 2762 AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message_.get(), |
| 2763 true); | 2763 true); |
| 2764 new NavigationNotificationObserver(controller, automation_, | 2764 new NavigationNotificationObserver(controller, automation_, |
| 2765 reply_message_.release(), | 2765 reply_message_.release(), |
| 2766 1, false, false); | 2766 1, false, false); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3099 } | 3099 } |
| 3100 | 3100 |
| 3101 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); | 3101 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); |
| 3102 if (host->extension_id() == extension_id_ && | 3102 if (host->extension_id() == extension_id_ && |
| 3103 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) { | 3103 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) { |
| 3104 AutomationJSONReply(automation_, reply_message_.release()) | 3104 AutomationJSONReply(automation_, reply_message_.release()) |
| 3105 .SendSuccess(NULL); | 3105 .SendSuccess(NULL); |
| 3106 delete this; | 3106 delete this; |
| 3107 } | 3107 } |
| 3108 } | 3108 } |
| OLD | NEW |