Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 8549022: Define DevTools content API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jam's comments addressed Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 #include "chrome/common/chrome_paths.h" 79 #include "chrome/common/chrome_paths.h"
80 #include "chrome/common/chrome_switches.h" 80 #include "chrome/common/chrome_switches.h"
81 #include "chrome/common/extensions/extension.h" 81 #include "chrome/common/extensions/extension.h"
82 #include "chrome/common/extensions/extension_constants.h" 82 #include "chrome/common/extensions/extension_constants.h"
83 #include "chrome/common/extensions/extension_error_utils.h" 83 #include "chrome/common/extensions/extension_error_utils.h"
84 #include "chrome/common/extensions/extension_file_util.h" 84 #include "chrome/common/extensions/extension_file_util.h"
85 #include "chrome/common/extensions/extension_messages.h" 85 #include "chrome/common/extensions/extension_messages.h"
86 #include "chrome/common/extensions/extension_resource.h" 86 #include "chrome/common/extensions/extension_resource.h"
87 #include "chrome/common/pref_names.h" 87 #include "chrome/common/pref_names.h"
88 #include "chrome/common/url_constants.h" 88 #include "chrome/common/url_constants.h"
89 #include "content/browser/debugger/devtools_manager.h"
90 #include "content/browser/plugin_process_host.h" 89 #include "content/browser/plugin_process_host.h"
91 #include "content/browser/plugin_service.h" 90 #include "content/browser/plugin_service.h"
92 #include "content/browser/user_metrics.h" 91 #include "content/browser/user_metrics.h"
93 #include "content/public/browser/browser_thread.h" 92 #include "content/public/browser/browser_thread.h"
93 #include "content/public/browser/devtools_agent_host_registry.h"
94 #include "content/public/browser/devtools_manager.h"
94 #include "content/public/browser/notification_service.h" 95 #include "content/public/browser/notification_service.h"
95 #include "content/public/browser/notification_types.h" 96 #include "content/public/browser/notification_types.h"
96 #include "content/public/browser/render_process_host.h" 97 #include "content/public/browser/render_process_host.h"
97 #include "content/public/common/pepper_plugin_info.h" 98 #include "content/public/common/pepper_plugin_info.h"
98 #include "googleurl/src/gurl.h" 99 #include "googleurl/src/gurl.h"
99 #include "net/base/registry_controlled_domain.h" 100 #include "net/base/registry_controlled_domain.h"
100 #include "webkit/database/database_tracker.h" 101 #include "webkit/database/database_tracker.h"
101 #include "webkit/database/database_util.h" 102 #include "webkit/database/database_util.h"
102 103
103 #if defined(OS_CHROMEOS) 104 #if defined(OS_CHROMEOS)
104 #include "chrome/browser/chromeos/cros/cros_library.h" 105 #include "chrome/browser/chromeos/cros/cros_library.h"
105 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" 106 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h"
106 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" 107 #include "chrome/browser/chromeos/extensions/input_method_event_router.h"
107 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" 108 #include "chrome/browser/chromeos/extensions/media_player_event_router.h"
108 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 109 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
109 #include "chrome/browser/extensions/extension_input_ime_api.h" 110 #include "chrome/browser/extensions/extension_input_ime_api.h"
110 #include "webkit/fileapi/file_system_context.h" 111 #include "webkit/fileapi/file_system_context.h"
111 #include "webkit/fileapi/file_system_mount_point_provider.h" 112 #include "webkit/fileapi/file_system_mount_point_provider.h"
112 #include "webkit/fileapi/file_system_path_manager.h" 113 #include "webkit/fileapi/file_system_path_manager.h"
113 #endif 114 #endif
114 115
115 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) 116 #if defined(OS_CHROMEOS) && defined(TOUCH_UI)
116 #include "chrome/browser/extensions/extension_input_ui_api.h" 117 #include "chrome/browser/extensions/extension_input_ui_api.h"
117 #endif 118 #endif
118 119
119 using base::Time; 120 using base::Time;
120 using content::BrowserThread; 121 using content::BrowserThread;
122 using content::DevToolsAgentHost;
123 using content::DevToolsAgentHostRegistry;
121 124
122 namespace errors = extension_manifest_errors; 125 namespace errors = extension_manifest_errors;
123 126
124 namespace { 127 namespace {
125 128
126 #if defined(OS_LINUX) 129 #if defined(OS_LINUX)
127 static const int kOmniboxIconPaddingLeft = 2; 130 static const int kOmniboxIconPaddingLeft = 2;
128 static const int kOmniboxIconPaddingRight = 2; 131 static const int kOmniboxIconPaddingRight = 2;
129 #elif defined(OS_MACOSX) 132 #elif defined(OS_MACOSX)
130 static const int kOmniboxIconPaddingLeft = 0; 133 static const int kOmniboxIconPaddingLeft = 0;
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 FilePath path; 603 FilePath path;
601 const Extension* current_extension = GetExtensionById(extension_id, false); 604 const Extension* current_extension = GetExtensionById(extension_id, false);
602 605
603 // Disable the extension if it's loaded. It might not be loaded if it crashed. 606 // Disable the extension if it's loaded. It might not be loaded if it crashed.
604 if (current_extension) { 607 if (current_extension) {
605 // If the extension has an inspector open for its background page, detach 608 // If the extension has an inspector open for its background page, detach
606 // the inspector and hang onto a cookie for it, so that we can reattach 609 // the inspector and hang onto a cookie for it, so that we can reattach
607 // later. 610 // later.
608 ExtensionProcessManager* manager = profile_->GetExtensionProcessManager(); 611 ExtensionProcessManager* manager = profile_->GetExtensionProcessManager();
609 ExtensionHost* host = manager->GetBackgroundHostForExtension(extension_id); 612 ExtensionHost* host = manager->GetBackgroundHostForExtension(extension_id);
610 if (host) { 613 if (host && DevToolsAgentHostRegistry::HasDevToolsAgentHost(
614 host->render_view_host())) {
611 // Look for an open inspector for the background page. 615 // Look for an open inspector for the background page.
612 int devtools_cookie = DevToolsManager::GetInstance()->DetachClientHost( 616 DevToolsAgentHost* agent =
613 host->render_view_host()); 617 DevToolsAgentHostRegistry::GetDevToolsAgentHost(
618 host->render_view_host());
619 int devtools_cookie =
620 content::DevToolsManager::GetInstance()->DetachClientHost(agent);
614 if (devtools_cookie >= 0) 621 if (devtools_cookie >= 0)
615 orphaned_dev_tools_[extension_id] = devtools_cookie; 622 orphaned_dev_tools_[extension_id] = devtools_cookie;
616 } 623 }
617 624
618 path = current_extension->path(); 625 path = current_extension->path();
619 DisableExtension(extension_id); 626 DisableExtension(extension_id);
620 disabled_extension_paths_[extension_id] = path; 627 disabled_extension_paths_[extension_id] = path;
621 } else { 628 } else {
622 path = unloaded_extension_paths_[extension_id]; 629 path = unloaded_extension_paths_[extension_id];
623 } 630 }
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after
2290 ExtensionErrorReporter::GetInstance()->ReportError(message, be_noisy); 2297 ExtensionErrorReporter::GetInstance()->ReportError(message, be_noisy);
2291 } 2298 }
2292 2299
2293 void ExtensionService::DidCreateRenderViewForBackgroundPage( 2300 void ExtensionService::DidCreateRenderViewForBackgroundPage(
2294 ExtensionHost* host) { 2301 ExtensionHost* host) {
2295 OrphanedDevTools::iterator iter = 2302 OrphanedDevTools::iterator iter =
2296 orphaned_dev_tools_.find(host->extension_id()); 2303 orphaned_dev_tools_.find(host->extension_id());
2297 if (iter == orphaned_dev_tools_.end()) 2304 if (iter == orphaned_dev_tools_.end())
2298 return; 2305 return;
2299 2306
2300 DevToolsManager::GetInstance()->AttachClientHost( 2307 DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost(
2301 iter->second, host->render_view_host()); 2308 host->render_view_host());
2309 content::DevToolsManager::GetInstance()->AttachClientHost(iter->second,
2310 agent);
2302 orphaned_dev_tools_.erase(iter); 2311 orphaned_dev_tools_.erase(iter);
2303 } 2312 }
2304 2313
2305 void ExtensionService::Observe(int type, 2314 void ExtensionService::Observe(int type,
2306 const content::NotificationSource& source, 2315 const content::NotificationSource& source,
2307 const content::NotificationDetails& details) { 2316 const content::NotificationDetails& details) {
2308 switch (type) { 2317 switch (type) {
2309 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { 2318 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: {
2310 if (profile_ != 2319 if (profile_ !=
2311 content::Source<Profile>(source).ptr()->GetOriginalProfile()) { 2320 content::Source<Profile>(source).ptr()->GetOriginalProfile()) {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2512 2521
2513 ExtensionService::NaClModuleInfoList::iterator 2522 ExtensionService::NaClModuleInfoList::iterator
2514 ExtensionService::FindNaClModule(const GURL& url) { 2523 ExtensionService::FindNaClModule(const GURL& url) {
2515 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2524 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2516 iter != nacl_module_list_.end(); ++iter) { 2525 iter != nacl_module_list_.end(); ++iter) {
2517 if (iter->url == url) 2526 if (iter->url == url)
2518 return iter; 2527 return iter;
2519 } 2528 }
2520 return nacl_module_list_.end(); 2529 return nacl_module_list_.end();
2521 } 2530 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_devtools_browsertests.cc ('k') | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698