| 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/extensions/api/developer_private/developer_private_api.
h" | 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/devtools/devtools_window.h" | 12 #include "chrome/browser/devtools/devtools_window.h" |
| 13 #include "chrome/browser/extensions/api/developer_private/developer_private_api_
factory.h" | 13 #include "chrome/browser/extensions/api/developer_private/developer_private_api_
factory.h" |
| 14 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" | 14 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" |
| 15 #include "chrome/browser/extensions/extension_disabled_ui.h" | 15 #include "chrome/browser/extensions/extension_disabled_ui.h" |
| 16 #include "chrome/browser/extensions/extension_error_reporter.h" | 16 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
| 18 #include "chrome/browser/extensions/extension_system.h" | 18 #include "chrome/browser/extensions/extension_system.h" |
| 19 #include "chrome/browser/extensions/management_policy.h" | 19 #include "chrome/browser/extensions/management_policy.h" |
| 20 #include "chrome/browser/extensions/shell_window_registry.h" | 20 #include "chrome/browser/extensions/shell_window_registry.h" |
| 21 #include "chrome/browser/extensions/unpacked_installer.h" | 21 #include "chrome/browser/extensions/unpacked_installer.h" |
| 22 #include "chrome/browser/extensions/updater/extension_updater.h" | 22 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 23 #include "chrome/browser/platform_util.h" | 23 #include "chrome/browser/platform_util.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/ui/chrome_select_file_policy.h" | 25 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 26 #include "chrome/browser/ui/extensions/shell_window.h" | 26 #include "chrome/browser/ui/extensions/shell_window.h" |
| 27 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 27 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 28 #include "chrome/browser/view_type_utils.h" | 28 #include "chrome/browser/view_type_utils.h" |
| 29 #include "chrome/common/extensions/api/developer_private.h" | 29 #include "chrome/common/extensions/api/developer_private.h" |
| 30 #include "chrome/common/extensions/background_info.h" |
| 30 #include "chrome/common/extensions/extension_icon_set.h" | 31 #include "chrome/common/extensions/extension_icon_set.h" |
| 31 #include "chrome/common/extensions/extension_resource.h" | 32 #include "chrome/common/extensions/extension_resource.h" |
| 32 #include "chrome/common/extensions/manifest_url_handler.h" | 33 #include "chrome/common/extensions/manifest_url_handler.h" |
| 33 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
| 34 #include "content/public/browser/render_process_host.h" | 35 #include "content/public/browser/render_process_host.h" |
| 35 #include "content/public/browser/render_view_host.h" | 36 #include "content/public/browser/render_view_host.h" |
| 36 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
| 37 #include "extensions/common/constants.h" | 38 #include "extensions/common/constants.h" |
| 38 #include "grit/chromium_strings.h" | 39 #include "grit/chromium_strings.h" |
| 39 #include "grit/generated_resources.h" | 40 #include "grit/generated_resources.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 ExtensionProcessManager* process_manager = | 282 ExtensionProcessManager* process_manager = |
| 282 ExtensionSystem::Get(profile())->process_manager(); | 283 ExtensionSystem::Get(profile())->process_manager(); |
| 283 GetInspectablePagesForExtensionProcess( | 284 GetInspectablePagesForExtensionProcess( |
| 284 process_manager->GetRenderViewHostsForExtension(extension->id()), | 285 process_manager->GetRenderViewHostsForExtension(extension->id()), |
| 285 &result); | 286 &result); |
| 286 | 287 |
| 287 // Get shell window views | 288 // Get shell window views |
| 288 GetShellWindowPagesForExtensionProfile(extension, &result); | 289 GetShellWindowPagesForExtensionProfile(extension, &result); |
| 289 | 290 |
| 290 // Include a link to start the lazy background page, if applicable. | 291 // Include a link to start the lazy background page, if applicable. |
| 291 if (extension->has_lazy_background_page() && extension_is_enabled && | 292 if (BackgroundInfo::HasLazyBackgroundPage(extension) && |
| 293 extension_is_enabled && |
| 292 !process_manager->GetBackgroundHostForExtension(extension->id())) { | 294 !process_manager->GetBackgroundHostForExtension(extension->id())) { |
| 293 result.push_back( | 295 result.push_back(constructInspectView( |
| 294 constructInspectView(extension->GetBackgroundURL(), -1, -1, false)); | 296 BackgroundInfo::GetBackgroundURL(extension), -1, -1, false)); |
| 295 } | 297 } |
| 296 | 298 |
| 297 ExtensionService* service = profile()->GetExtensionService(); | 299 ExtensionService* service = profile()->GetExtensionService(); |
| 298 // Repeat for the incognito process, if applicable. Don't try to get | 300 // Repeat for the incognito process, if applicable. Don't try to get |
| 299 // shell windows for incognito process. | 301 // shell windows for incognito process. |
| 300 if (service->profile()->HasOffTheRecordProfile() && | 302 if (service->profile()->HasOffTheRecordProfile() && |
| 301 extension->incognito_split_mode()) { | 303 extension->incognito_split_mode()) { |
| 302 process_manager = ExtensionSystem::Get( | 304 process_manager = ExtensionSystem::Get( |
| 303 service->profile()->GetOffTheRecordProfile())->process_manager(); | 305 service->profile()->GetOffTheRecordProfile())->process_manager(); |
| 304 GetInspectablePagesForExtensionProcess( | 306 GetInspectablePagesForExtensionProcess( |
| 305 process_manager->GetRenderViewHostsForExtension(extension->id()), | 307 process_manager->GetRenderViewHostsForExtension(extension->id()), |
| 306 &result); | 308 &result); |
| 307 | 309 |
| 308 if (extension->has_lazy_background_page() && extension_is_enabled && | 310 if (BackgroundInfo::HasLazyBackgroundPage(extension) && |
| 311 extension_is_enabled && |
| 309 !process_manager->GetBackgroundHostForExtension(extension->id())) { | 312 !process_manager->GetBackgroundHostForExtension(extension->id())) { |
| 310 result.push_back( | 313 result.push_back(constructInspectView( |
| 311 constructInspectView(extension->GetBackgroundURL(), -1, -1, false)); | 314 BackgroundInfo::GetBackgroundURL(extension), -1, -1, false)); |
| 312 } | 315 } |
| 313 } | 316 } |
| 314 | 317 |
| 315 return result; | 318 return result; |
| 316 } | 319 } |
| 317 | 320 |
| 318 bool DeveloperPrivateGetItemsInfoFunction::RunImpl() { | 321 bool DeveloperPrivateGetItemsInfoFunction::RunImpl() { |
| 319 ItemInfoList items; | 322 ItemInfoList items; |
| 320 ExtensionSystem* system = ExtensionSystem::Get(profile()); | 323 ExtensionSystem* system = ExtensionSystem::Get(profile()); |
| 321 scoped_ptr<developer::GetItemsInfo::Params> params( | 324 scoped_ptr<developer::GetItemsInfo::Params> params( |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 636 |
| 634 #undef SET_STRING | 637 #undef SET_STRING |
| 635 return true; | 638 return true; |
| 636 } | 639 } |
| 637 | 640 |
| 638 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} | 641 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} |
| 639 | 642 |
| 640 } // namespace api | 643 } // namespace api |
| 641 | 644 |
| 642 } // namespace extensions | 645 } // namespace extensions |
| OLD | NEW |