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/ui/webui/extensions/extension_settings_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 306 } |
307 | 307 |
308 void ExtensionSettingsHandler::RegisterMessages() { | 308 void ExtensionSettingsHandler::RegisterMessages() { |
309 // Don't override an |extension_service_| or |management_policy_| injected | 309 // Don't override an |extension_service_| or |management_policy_| injected |
310 // for testing. | 310 // for testing. |
311 if (!extension_service_) { | 311 if (!extension_service_) { |
312 extension_service_ = Profile::FromWebUI(web_ui())->GetOriginalProfile()-> | 312 extension_service_ = Profile::FromWebUI(web_ui())->GetOriginalProfile()-> |
313 GetExtensionService(); | 313 GetExtensionService(); |
314 } | 314 } |
315 if (!management_policy_) { | 315 if (!management_policy_) { |
316 management_policy_ = ExtensionSystem::Get( | 316 management_policy_ = extensions::ExtensionSystem::Get( |
317 extension_service_->profile())->management_policy(); | 317 extension_service_->profile())->management_policy(); |
318 } | 318 } |
319 | 319 |
320 web_ui()->RegisterMessageCallback("extensionSettingsRequestExtensionsData", | 320 web_ui()->RegisterMessageCallback("extensionSettingsRequestExtensionsData", |
321 base::Bind(&ExtensionSettingsHandler::HandleRequestExtensionsData, | 321 base::Bind(&ExtensionSettingsHandler::HandleRequestExtensionsData, |
322 base::Unretained(this))); | 322 base::Unretained(this))); |
323 web_ui()->RegisterMessageCallback("extensionSettingsToggleDeveloperMode", | 323 web_ui()->RegisterMessageCallback("extensionSettingsToggleDeveloperMode", |
324 base::Bind(&ExtensionSettingsHandler::HandleToggleDeveloperMode, | 324 base::Bind(&ExtensionSettingsHandler::HandleToggleDeveloperMode, |
325 base::Unretained(this))); | 325 base::Unretained(this))); |
326 web_ui()->RegisterMessageCallback("extensionSettingsInspect", | 326 web_ui()->RegisterMessageCallback("extensionSettingsInspect", |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 const Extension* extension = | 560 const Extension* extension = |
561 extension_service_->extensions()->GetByID(extension_id); | 561 extension_service_->extensions()->GetByID(extension_id); |
562 DCHECK(extension); | 562 DCHECK(extension); |
563 | 563 |
564 Profile* profile = extension_service_->profile(); | 564 Profile* profile = extension_service_->profile(); |
565 if (incognito) | 565 if (incognito) |
566 profile = profile->GetOffTheRecordProfile(); | 566 profile = profile->GetOffTheRecordProfile(); |
567 | 567 |
568 ExtensionProcessManager* pm = profile->GetExtensionProcessManager(); | 568 ExtensionProcessManager* pm = profile->GetExtensionProcessManager(); |
569 extensions::LazyBackgroundTaskQueue* queue = | 569 extensions::LazyBackgroundTaskQueue* queue = |
570 ExtensionSystem::Get(profile)->lazy_background_task_queue(); | 570 extensions::ExtensionSystem::Get(profile)->lazy_background_task_queue(); |
571 | 571 |
572 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension->id()); | 572 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension->id()); |
573 if (host) { | 573 if (host) { |
574 InspectExtensionHost(host); | 574 InspectExtensionHost(host); |
575 } else { | 575 } else { |
576 queue->AddPendingTask( | 576 queue->AddPendingTask( |
577 profile, extension->id(), | 577 profile, extension->id(), |
578 base::Bind(&ExtensionSettingsHandler::InspectExtensionHost, | 578 base::Bind(&ExtensionSettingsHandler::InspectExtensionHost, |
579 base::Unretained(this))); | 579 base::Unretained(this))); |
580 } | 580 } |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 return extension_uninstall_dialog_.get(); | 873 return extension_uninstall_dialog_.get(); |
874 #else | 874 #else |
875 return NULL; | 875 return NULL; |
876 #endif // !defined(OS_ANDROID) | 876 #endif // !defined(OS_ANDROID) |
877 } | 877 } |
878 | 878 |
879 void ExtensionSettingsHandler::InspectExtensionHost(ExtensionHost* host) { | 879 void ExtensionSettingsHandler::InspectExtensionHost(ExtensionHost* host) { |
880 if (host) | 880 if (host) |
881 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); | 881 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); |
882 } | 882 } |
OLD | NEW |