| 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 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/bookmarks/bookmark_model.h" | 28 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 29 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 29 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 30 #include "chrome/browser/browser_process.h" | 30 #include "chrome/browser/browser_process.h" |
| 31 #include "chrome/browser/chrome_notification_types.h" | 31 #include "chrome/browser/chrome_notification_types.h" |
| 32 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 32 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 33 #include "chrome/browser/extensions/crx_installer.h" | 33 #include "chrome/browser/extensions/crx_installer.h" |
| 34 #include "chrome/browser/extensions/extension_host.h" | 34 #include "chrome/browser/extensions/extension_host.h" |
| 35 #include "chrome/browser/extensions/extension_service.h" | 35 #include "chrome/browser/extensions/extension_service.h" |
| 36 #include "chrome/browser/extensions/extension_system.h" | 36 #include "chrome/browser/extensions/extension_system.h" |
| 37 #include "chrome/browser/extensions/extension_tab_util.h" | 37 #include "chrome/browser/extensions/extension_tab_util.h" |
| 38 #include "chrome/browser/extensions/launch_util.h" | |
| 39 #include "chrome/browser/history/history_types.h" | 38 #include "chrome/browser/history/history_types.h" |
| 40 #include "chrome/browser/history/top_sites.h" | 39 #include "chrome/browser/history/top_sites.h" |
| 41 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 40 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
| 42 #include "chrome/browser/infobars/infobar_service.h" | 41 #include "chrome/browser/infobars/infobar_service.h" |
| 43 #include "chrome/browser/metrics/metric_event_duration_details.h" | 42 #include "chrome/browser/metrics/metric_event_duration_details.h" |
| 44 #include "chrome/browser/notifications/balloon.h" | 43 #include "chrome/browser/notifications/balloon.h" |
| 45 #include "chrome/browser/notifications/balloon_collection.h" | 44 #include "chrome/browser/notifications/balloon_collection.h" |
| 46 #include "chrome/browser/notifications/balloon_host.h" | 45 #include "chrome/browser/notifications/balloon_host.h" |
| 47 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" | 46 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" |
| 48 #include "chrome/browser/notifications/notification.h" | 47 #include "chrome/browser/notifications/notification.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 62 #include "chrome/browser/ui/host_desktop.h" | 61 #include "chrome/browser/ui/host_desktop.h" |
| 63 #include "chrome/browser/ui/login/login_prompt.h" | 62 #include "chrome/browser/ui/login/login_prompt.h" |
| 64 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 63 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 65 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 64 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 66 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" | 65 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" |
| 67 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 66 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 68 #include "chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.h" | 67 #include "chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.h" |
| 69 #include "chrome/common/automation_constants.h" | 68 #include "chrome/common/automation_constants.h" |
| 70 #include "chrome/common/automation_messages.h" | 69 #include "chrome/common/automation_messages.h" |
| 71 #include "chrome/common/content_settings_types.h" | 70 #include "chrome/common/content_settings_types.h" |
| 71 #include "chrome/common/extensions/extension_constants.h" |
| 72 #include "content/public/browser/dom_operation_notification_details.h" | 72 #include "content/public/browser/dom_operation_notification_details.h" |
| 73 #include "content/public/browser/navigation_controller.h" | 73 #include "content/public/browser/navigation_controller.h" |
| 74 #include "content/public/browser/notification_service.h" | 74 #include "content/public/browser/notification_service.h" |
| 75 #include "content/public/browser/render_process_host.h" | 75 #include "content/public/browser/render_process_host.h" |
| 76 #include "content/public/browser/render_view_host.h" | 76 #include "content/public/browser/render_view_host.h" |
| 77 #include "content/public/browser/web_contents.h" | 77 #include "content/public/browser/web_contents.h" |
| 78 #include "content/public/common/process_type.h" | 78 #include "content/public/common/process_type.h" |
| 79 #include "extensions/browser/process_manager.h" | 79 #include "extensions/browser/process_manager.h" |
| 80 #include "extensions/common/extension.h" | 80 #include "extensions/common/extension.h" |
| 81 #include "extensions/common/manifest.h" | 81 #include "extensions/common/manifest.h" |
| (...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1924 AppLaunchObserver::AppLaunchObserver( | 1924 AppLaunchObserver::AppLaunchObserver( |
| 1925 NavigationController* controller, | 1925 NavigationController* controller, |
| 1926 AutomationProvider* automation, | 1926 AutomationProvider* automation, |
| 1927 IPC::Message* reply_message, | 1927 IPC::Message* reply_message, |
| 1928 extensions::LaunchContainer launch_container) | 1928 extensions::LaunchContainer launch_container) |
| 1929 : controller_(controller), | 1929 : controller_(controller), |
| 1930 automation_(automation->AsWeakPtr()), | 1930 automation_(automation->AsWeakPtr()), |
| 1931 reply_message_(reply_message), | 1931 reply_message_(reply_message), |
| 1932 launch_container_(launch_container), | 1932 launch_container_(launch_container), |
| 1933 new_window_id_(extension_misc::kUnknownWindowId) { | 1933 new_window_id_(extension_misc::kUnknownWindowId) { |
| 1934 if (launch_container_ == extensions::LAUNCH_TAB) { | 1934 if (launch_container_ == extensions::LAUNCH_CONTAINER_TAB) { |
| 1935 // Need to wait for the currently-active tab to reload. | 1935 // Need to wait for the currently-active tab to reload. |
| 1936 content::Source<NavigationController> source(controller_); | 1936 content::Source<NavigationController> source(controller_); |
| 1937 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); | 1937 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); |
| 1938 } else { | 1938 } else { |
| 1939 // Need to wait for a new tab in a new window to load. | 1939 // Need to wait for a new tab in a new window to load. |
| 1940 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, | 1940 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, |
| 1941 content::NotificationService::AllSources()); | 1941 content::NotificationService::AllSources()); |
| 1942 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 1942 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 1943 content::NotificationService::AllSources()); | 1943 content::NotificationService::AllSources()); |
| 1944 } | 1944 } |
| 1945 } | 1945 } |
| 1946 | 1946 |
| 1947 AppLaunchObserver::~AppLaunchObserver() {} | 1947 AppLaunchObserver::~AppLaunchObserver() {} |
| 1948 | 1948 |
| 1949 void AppLaunchObserver::Observe(int type, | 1949 void AppLaunchObserver::Observe(int type, |
| 1950 const content::NotificationSource& source, | 1950 const content::NotificationSource& source, |
| 1951 const content::NotificationDetails& details) { | 1951 const content::NotificationDetails& details) { |
| 1952 if (type == chrome::NOTIFICATION_BROWSER_WINDOW_READY) { | 1952 if (type == chrome::NOTIFICATION_BROWSER_WINDOW_READY) { |
| 1953 new_window_id_ = extensions::ExtensionTabUtil::GetWindowId( | 1953 new_window_id_ = extensions::ExtensionTabUtil::GetWindowId( |
| 1954 content::Source<Browser>(source).ptr()); | 1954 content::Source<Browser>(source).ptr()); |
| 1955 return; | 1955 return; |
| 1956 } | 1956 } |
| 1957 | 1957 |
| 1958 DCHECK_EQ(content::NOTIFICATION_LOAD_STOP, type); | 1958 DCHECK_EQ(content::NOTIFICATION_LOAD_STOP, type); |
| 1959 SessionTabHelper* session_tab_helper = SessionTabHelper::FromWebContents( | 1959 SessionTabHelper* session_tab_helper = SessionTabHelper::FromWebContents( |
| 1960 content::Source<NavigationController>(source)->GetWebContents()); | 1960 content::Source<NavigationController>(source)->GetWebContents()); |
| 1961 if ((launch_container_ == extensions::LAUNCH_TAB) || | 1961 if ((launch_container_ == extensions::LAUNCH_CONTAINER_TAB) || |
| 1962 (session_tab_helper && | 1962 (session_tab_helper && |
| 1963 (session_tab_helper->window_id().id() == new_window_id_))) { | 1963 (session_tab_helper->window_id().id() == new_window_id_))) { |
| 1964 if (automation_.get()) { | 1964 if (automation_.get()) { |
| 1965 AutomationJSONReply(automation_.get(), reply_message_.release()) | 1965 AutomationJSONReply(automation_.get(), reply_message_.release()) |
| 1966 .SendSuccess(NULL); | 1966 .SendSuccess(NULL); |
| 1967 } | 1967 } |
| 1968 delete this; | 1968 delete this; |
| 1969 } | 1969 } |
| 1970 } | 1970 } |
| 1971 | 1971 |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2645 if (automation_.get()) { | 2645 if (automation_.get()) { |
| 2646 AutomationJSONReply(automation_.get(), reply_message_.release()) | 2646 AutomationJSONReply(automation_.get(), reply_message_.release()) |
| 2647 .SendSuccess(NULL); | 2647 .SendSuccess(NULL); |
| 2648 } | 2648 } |
| 2649 delete this; | 2649 delete this; |
| 2650 } | 2650 } |
| 2651 } else { | 2651 } else { |
| 2652 NOTREACHED(); | 2652 NOTREACHED(); |
| 2653 } | 2653 } |
| 2654 } | 2654 } |
| OLD | NEW |