| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "chrome/browser/notifications/balloon.h" | 42 #include "chrome/browser/notifications/balloon.h" |
| 43 #include "chrome/browser/notifications/balloon_collection.h" | 43 #include "chrome/browser/notifications/balloon_collection.h" |
| 44 #include "chrome/browser/notifications/balloon_host.h" | 44 #include "chrome/browser/notifications/balloon_host.h" |
| 45 #include "chrome/browser/notifications/notification.h" | 45 #include "chrome/browser/notifications/notification.h" |
| 46 #include "chrome/browser/notifications/notification_ui_manager.h" | 46 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 47 #include "chrome/browser/password_manager/password_store_change.h" | 47 #include "chrome/browser/password_manager/password_store_change.h" |
| 48 #include "chrome/browser/profiles/profile.h" | 48 #include "chrome/browser/profiles/profile.h" |
| 49 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 49 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
| 50 #include "chrome/browser/search_engines/template_url_service.h" | 50 #include "chrome/browser/search_engines/template_url_service.h" |
| 51 #include "chrome/browser/search_engines/template_url_service_factory.h" | 51 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 52 #include "chrome/browser/sessions/restore_tab_helper.h" | 52 #include "chrome/browser/sessions/session_tab_helper.h" |
| 53 #include "chrome/browser/sessions/tab_restore_service.h" | 53 #include "chrome/browser/sessions/tab_restore_service.h" |
| 54 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 54 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 55 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 55 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
| 56 #include "chrome/browser/translate/page_translated_details.h" | 56 #include "chrome/browser/translate/page_translated_details.h" |
| 57 #include "chrome/browser/translate/translate_infobar_delegate.h" | 57 #include "chrome/browser/translate/translate_infobar_delegate.h" |
| 58 #include "chrome/browser/translate/translate_tab_helper.h" | 58 #include "chrome/browser/translate/translate_tab_helper.h" |
| 59 #include "chrome/browser/ui/browser.h" | 59 #include "chrome/browser/ui/browser.h" |
| 60 #include "chrome/browser/ui/browser_list.h" | 60 #include "chrome/browser/ui/browser_list.h" |
| 61 #include "chrome/browser/ui/browser_tabstrip.h" | 61 #include "chrome/browser/ui/browser_tabstrip.h" |
| 62 #include "chrome/browser/ui/browser_window.h" | 62 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 // Store the new browser ID and continue waiting for a new tab within it | 821 // Store the new browser ID and continue waiting for a new tab within it |
| 822 // to stop loading. | 822 // to stop loading. |
| 823 new_window_id_ = ExtensionTabUtil::GetWindowId( | 823 new_window_id_ = ExtensionTabUtil::GetWindowId( |
| 824 content::Source<Browser>(source).ptr()); | 824 content::Source<Browser>(source).ptr()); |
| 825 } else if (type == content::NOTIFICATION_LOAD_STOP) { | 825 } else if (type == content::NOTIFICATION_LOAD_STOP) { |
| 826 // Only send the result if the loaded tab is in the new window. | 826 // Only send the result if the loaded tab is in the new window. |
| 827 NavigationController* controller = | 827 NavigationController* controller = |
| 828 content::Source<NavigationController>(source).ptr(); | 828 content::Source<NavigationController>(source).ptr(); |
| 829 TabContents* tab = | 829 TabContents* tab = |
| 830 TabContents::FromWebContents(controller->GetWebContents()); | 830 TabContents::FromWebContents(controller->GetWebContents()); |
| 831 int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1; | 831 int window_id = tab ? tab->session_tab_helper()->window_id().id() : -1; |
| 832 if (window_id == new_window_id_) { | 832 if (window_id == new_window_id_) { |
| 833 if (use_json_interface_) { | 833 if (use_json_interface_) { |
| 834 AutomationJSONReply(automation_, | 834 AutomationJSONReply(automation_, |
| 835 reply_message_.release()).SendSuccess(NULL); | 835 reply_message_.release()).SendSuccess(NULL); |
| 836 } else { | 836 } else { |
| 837 if (for_browser_command_) { | 837 if (for_browser_command_) { |
| 838 AutomationMsg_WindowExecuteCommand::WriteReplyParams( | 838 AutomationMsg_WindowExecuteCommand::WriteReplyParams( |
| 839 reply_message_.get(), true); | 839 reply_message_.get(), true); |
| 840 } | 840 } |
| 841 automation_->Send(reply_message_.release()); | 841 automation_->Send(reply_message_.release()); |
| (...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2201 reply_message_.release()).SendSuccess(NULL); | 2201 reply_message_.release()).SendSuccess(NULL); |
| 2202 } | 2202 } |
| 2203 delete this; | 2203 delete this; |
| 2204 return; | 2204 return; |
| 2205 } else { | 2205 } else { |
| 2206 // The app has launched only if the loaded tab is in the new window. | 2206 // The app has launched only if the loaded tab is in the new window. |
| 2207 NavigationController* controller = | 2207 NavigationController* controller = |
| 2208 content::Source<NavigationController>(source).ptr(); | 2208 content::Source<NavigationController>(source).ptr(); |
| 2209 TabContents* tab = | 2209 TabContents* tab = |
| 2210 TabContents::FromWebContents(controller->GetWebContents()); | 2210 TabContents::FromWebContents(controller->GetWebContents()); |
| 2211 int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1; | 2211 int window_id = tab ? tab->session_tab_helper()->window_id().id() : -1; |
| 2212 if (window_id == new_window_id_) { | 2212 if (window_id == new_window_id_) { |
| 2213 if (automation_) { | 2213 if (automation_) { |
| 2214 AutomationJSONReply(automation_, | 2214 AutomationJSONReply(automation_, |
| 2215 reply_message_.release()).SendSuccess(NULL); | 2215 reply_message_.release()).SendSuccess(NULL); |
| 2216 } | 2216 } |
| 2217 delete this; | 2217 delete this; |
| 2218 return; | 2218 return; |
| 2219 } | 2219 } |
| 2220 } | 2220 } |
| 2221 } else if (type == chrome::NOTIFICATION_BROWSER_WINDOW_READY) { | 2221 } else if (type == chrome::NOTIFICATION_BROWSER_WINDOW_READY) { |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2857 // Store the new browser ID and continue waiting for a new tab within it | 2857 // Store the new browser ID and continue waiting for a new tab within it |
| 2858 // to stop loading. | 2858 // to stop loading. |
| 2859 new_window_id_ = ExtensionTabUtil::GetWindowId( | 2859 new_window_id_ = ExtensionTabUtil::GetWindowId( |
| 2860 content::Source<Browser>(source).ptr()); | 2860 content::Source<Browser>(source).ptr()); |
| 2861 } else if (type == content::NOTIFICATION_LOAD_STOP) { | 2861 } else if (type == content::NOTIFICATION_LOAD_STOP) { |
| 2862 // Only send the result if the loaded tab is in the new window. | 2862 // Only send the result if the loaded tab is in the new window. |
| 2863 NavigationController* controller = | 2863 NavigationController* controller = |
| 2864 content::Source<NavigationController>(source).ptr(); | 2864 content::Source<NavigationController>(source).ptr(); |
| 2865 TabContents* tab = | 2865 TabContents* tab = |
| 2866 TabContents::FromWebContents(controller->GetWebContents()); | 2866 TabContents::FromWebContents(controller->GetWebContents()); |
| 2867 int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1; | 2867 int window_id = tab ? tab->session_tab_helper()->window_id().id() : -1; |
| 2868 if (window_id == new_window_id_) { | 2868 if (window_id == new_window_id_) { |
| 2869 if (automation_) { | 2869 if (automation_) { |
| 2870 AutomationJSONReply(automation_, reply_message_.release()) | 2870 AutomationJSONReply(automation_, reply_message_.release()) |
| 2871 .SendSuccess(NULL); | 2871 .SendSuccess(NULL); |
| 2872 } | 2872 } |
| 2873 delete this; | 2873 delete this; |
| 2874 } | 2874 } |
| 2875 } else { | 2875 } else { |
| 2876 NOTREACHED(); | 2876 NOTREACHED(); |
| 2877 } | 2877 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2967 if (type == chrome::NOTIFICATION_BROWSER_OPENED) { | 2967 if (type == chrome::NOTIFICATION_BROWSER_OPENED) { |
| 2968 // Store the new browser ID and continue waiting for NOTIFICATION_LOAD_STOP. | 2968 // Store the new browser ID and continue waiting for NOTIFICATION_LOAD_STOP. |
| 2969 new_window_id_ = ExtensionTabUtil::GetWindowId( | 2969 new_window_id_ = ExtensionTabUtil::GetWindowId( |
| 2970 content::Source<Browser>(source).ptr()); | 2970 content::Source<Browser>(source).ptr()); |
| 2971 } else if (type == content::NOTIFICATION_LOAD_STOP) { | 2971 } else if (type == content::NOTIFICATION_LOAD_STOP) { |
| 2972 // Only consider if the loaded tab is in the new window. | 2972 // Only consider if the loaded tab is in the new window. |
| 2973 NavigationController* controller = | 2973 NavigationController* controller = |
| 2974 content::Source<NavigationController>(source).ptr(); | 2974 content::Source<NavigationController>(source).ptr(); |
| 2975 TabContents* tab = TabContents::FromWebContents( | 2975 TabContents* tab = TabContents::FromWebContents( |
| 2976 controller->GetWebContents()); | 2976 controller->GetWebContents()); |
| 2977 int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1; | 2977 int window_id = tab ? tab->session_tab_helper()->window_id().id() : -1; |
| 2978 if (window_id == new_window_id_ && --num_loads_ == 0) { | 2978 if (window_id == new_window_id_ && --num_loads_ == 0) { |
| 2979 if (automation_) { | 2979 if (automation_) { |
| 2980 AutomationJSONReply(automation_, reply_message_.release()) | 2980 AutomationJSONReply(automation_, reply_message_.release()) |
| 2981 .SendSuccess(NULL); | 2981 .SendSuccess(NULL); |
| 2982 } | 2982 } |
| 2983 delete this; | 2983 delete this; |
| 2984 } | 2984 } |
| 2985 } else { | 2985 } else { |
| 2986 NOTREACHED(); | 2986 NOTREACHED(); |
| 2987 } | 2987 } |
| 2988 } | 2988 } |
| OLD | NEW |