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/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 #include "chrome/common/chrome_notification_types.h" | 77 #include "chrome/common/chrome_notification_types.h" |
78 #include "chrome/common/chrome_switches.h" | 78 #include "chrome/common/chrome_switches.h" |
79 #include "chrome/common/extensions/extension.h" | 79 #include "chrome/common/extensions/extension.h" |
80 #include "chrome/common/extensions/extension_constants.h" | 80 #include "chrome/common/extensions/extension_constants.h" |
81 #include "chrome/common/extensions/extension_error_utils.h" | 81 #include "chrome/common/extensions/extension_error_utils.h" |
82 #include "chrome/common/extensions/extension_file_util.h" | 82 #include "chrome/common/extensions/extension_file_util.h" |
83 #include "chrome/common/extensions/extension_messages.h" | 83 #include "chrome/common/extensions/extension_messages.h" |
84 #include "chrome/common/extensions/extension_resource.h" | 84 #include "chrome/common/extensions/extension_resource.h" |
85 #include "chrome/common/pref_names.h" | 85 #include "chrome/common/pref_names.h" |
86 #include "chrome/common/url_constants.h" | 86 #include "chrome/common/url_constants.h" |
87 #include "content/browser/debugger/devtools_manager.h" | |
88 #include "content/browser/plugin_process_host.h" | 87 #include "content/browser/plugin_process_host.h" |
89 #include "content/browser/plugin_service.h" | 88 #include "content/browser/plugin_service.h" |
90 #include "content/browser/user_metrics.h" | 89 #include "content/browser/user_metrics.h" |
91 #include "content/common/pepper_plugin_registry.h" | 90 #include "content/common/pepper_plugin_registry.h" |
92 #include "content/public/browser/browser_thread.h" | 91 #include "content/public/browser/browser_thread.h" |
| 92 #include "content/public/browser/devtools/devtools_agent_host_registry.h" |
| 93 #include "content/public/browser/devtools/devtools_manager.h" |
93 #include "content/public/browser/notification_service.h" | 94 #include "content/public/browser/notification_service.h" |
94 #include "content/public/browser/notification_types.h" | 95 #include "content/public/browser/notification_types.h" |
95 #include "content/public/browser/render_process_host.h" | 96 #include "content/public/browser/render_process_host.h" |
96 #include "googleurl/src/gurl.h" | 97 #include "googleurl/src/gurl.h" |
97 #include "net/base/registry_controlled_domain.h" | 98 #include "net/base/registry_controlled_domain.h" |
98 #include "webkit/database/database_tracker.h" | 99 #include "webkit/database/database_tracker.h" |
99 #include "webkit/database/database_util.h" | 100 #include "webkit/database/database_util.h" |
100 | 101 |
101 #if defined(OS_CHROMEOS) | 102 #if defined(OS_CHROMEOS) |
102 #include "chrome/browser/chromeos/cros/cros_library.h" | 103 #include "chrome/browser/chromeos/cros/cros_library.h" |
103 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" | 104 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" |
104 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" | 105 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
105 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" | 106 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" |
106 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 107 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
107 #include "chrome/browser/extensions/extension_input_ime_api.h" | 108 #include "chrome/browser/extensions/extension_input_ime_api.h" |
108 #include "webkit/fileapi/file_system_context.h" | 109 #include "webkit/fileapi/file_system_context.h" |
109 #include "webkit/fileapi/file_system_mount_point_provider.h" | 110 #include "webkit/fileapi/file_system_mount_point_provider.h" |
110 #include "webkit/fileapi/file_system_path_manager.h" | 111 #include "webkit/fileapi/file_system_path_manager.h" |
111 #endif | 112 #endif |
112 | 113 |
113 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) | 114 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) |
114 #include "chrome/browser/extensions/extension_input_ui_api.h" | 115 #include "chrome/browser/extensions/extension_input_ui_api.h" |
115 #endif | 116 #endif |
116 | 117 |
117 using base::Time; | 118 using base::Time; |
118 using content::BrowserThread; | 119 using content::BrowserThread; |
| 120 using content::DevToolsAgentHost; |
| 121 using content::DevToolsAgentHostRegistry; |
119 | 122 |
120 namespace errors = extension_manifest_errors; | 123 namespace errors = extension_manifest_errors; |
121 | 124 |
122 namespace { | 125 namespace { |
123 | 126 |
124 #if defined(OS_LINUX) | 127 #if defined(OS_LINUX) |
125 static const int kOmniboxIconPaddingLeft = 2; | 128 static const int kOmniboxIconPaddingLeft = 2; |
126 static const int kOmniboxIconPaddingRight = 2; | 129 static const int kOmniboxIconPaddingRight = 2; |
127 #elif defined(OS_MACOSX) | 130 #elif defined(OS_MACOSX) |
128 static const int kOmniboxIconPaddingLeft = 0; | 131 static const int kOmniboxIconPaddingLeft = 0; |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 FilePath path; | 595 FilePath path; |
593 const Extension* current_extension = GetExtensionById(extension_id, false); | 596 const Extension* current_extension = GetExtensionById(extension_id, false); |
594 | 597 |
595 // Disable the extension if it's loaded. It might not be loaded if it crashed. | 598 // Disable the extension if it's loaded. It might not be loaded if it crashed. |
596 if (current_extension) { | 599 if (current_extension) { |
597 // If the extension has an inspector open for its background page, detach | 600 // If the extension has an inspector open for its background page, detach |
598 // the inspector and hang onto a cookie for it, so that we can reattach | 601 // the inspector and hang onto a cookie for it, so that we can reattach |
599 // later. | 602 // later. |
600 ExtensionProcessManager* manager = profile_->GetExtensionProcessManager(); | 603 ExtensionProcessManager* manager = profile_->GetExtensionProcessManager(); |
601 ExtensionHost* host = manager->GetBackgroundHostForExtension(extension_id); | 604 ExtensionHost* host = manager->GetBackgroundHostForExtension(extension_id); |
602 if (host) { | 605 if (host && DevToolsAgentHostRegistry::HasDevToolsAgentHost( |
| 606 host->render_view_host())) { |
603 // Look for an open inspector for the background page. | 607 // Look for an open inspector for the background page. |
604 int devtools_cookie = DevToolsManager::GetInstance()->DetachClientHost( | 608 DevToolsAgentHost* agent = |
605 host->render_view_host()); | 609 DevToolsAgentHostRegistry::GetDevToolsAgentHost( |
| 610 host->render_view_host()); |
| 611 int devtools_cookie = |
| 612 content::DevToolsManager::GetInstance()->DetachClientHost(agent); |
606 if (devtools_cookie >= 0) | 613 if (devtools_cookie >= 0) |
607 orphaned_dev_tools_[extension_id] = devtools_cookie; | 614 orphaned_dev_tools_[extension_id] = devtools_cookie; |
608 } | 615 } |
609 | 616 |
610 path = current_extension->path(); | 617 path = current_extension->path(); |
611 DisableExtension(extension_id); | 618 DisableExtension(extension_id); |
612 disabled_extension_paths_[extension_id] = path; | 619 disabled_extension_paths_[extension_id] = path; |
613 } else { | 620 } else { |
614 path = unloaded_extension_paths_[extension_id]; | 621 path = unloaded_extension_paths_[extension_id]; |
615 } | 622 } |
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2287 ExtensionErrorReporter::GetInstance()->ReportError(message, be_noisy); | 2294 ExtensionErrorReporter::GetInstance()->ReportError(message, be_noisy); |
2288 } | 2295 } |
2289 | 2296 |
2290 void ExtensionService::DidCreateRenderViewForBackgroundPage( | 2297 void ExtensionService::DidCreateRenderViewForBackgroundPage( |
2291 ExtensionHost* host) { | 2298 ExtensionHost* host) { |
2292 OrphanedDevTools::iterator iter = | 2299 OrphanedDevTools::iterator iter = |
2293 orphaned_dev_tools_.find(host->extension_id()); | 2300 orphaned_dev_tools_.find(host->extension_id()); |
2294 if (iter == orphaned_dev_tools_.end()) | 2301 if (iter == orphaned_dev_tools_.end()) |
2295 return; | 2302 return; |
2296 | 2303 |
2297 DevToolsManager::GetInstance()->AttachClientHost( | 2304 DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( |
2298 iter->second, host->render_view_host()); | 2305 host->render_view_host()); |
| 2306 content::DevToolsManager::GetInstance()->AttachClientHost(iter->second, |
| 2307 agent); |
2299 orphaned_dev_tools_.erase(iter); | 2308 orphaned_dev_tools_.erase(iter); |
2300 } | 2309 } |
2301 | 2310 |
2302 void ExtensionService::Observe(int type, | 2311 void ExtensionService::Observe(int type, |
2303 const content::NotificationSource& source, | 2312 const content::NotificationSource& source, |
2304 const content::NotificationDetails& details) { | 2313 const content::NotificationDetails& details) { |
2305 switch (type) { | 2314 switch (type) { |
2306 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { | 2315 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { |
2307 if (profile_ != | 2316 if (profile_ != |
2308 content::Source<Profile>(source).ptr()->GetOriginalProfile()) { | 2317 content::Source<Profile>(source).ptr()->GetOriginalProfile()) { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2511 | 2520 |
2512 ExtensionService::NaClModuleInfoList::iterator | 2521 ExtensionService::NaClModuleInfoList::iterator |
2513 ExtensionService::FindNaClModule(const GURL& url) { | 2522 ExtensionService::FindNaClModule(const GURL& url) { |
2514 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2523 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
2515 iter != nacl_module_list_.end(); ++iter) { | 2524 iter != nacl_module_list_.end(); ++iter) { |
2516 if (iter->url == url) | 2525 if (iter->url == url) |
2517 return iter; | 2526 return iter; |
2518 } | 2527 } |
2519 return nacl_module_list_.end(); | 2528 return nacl_module_list_.end(); |
2520 } | 2529 } |
OLD | NEW |