| 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/component_loader.h" | 5 #include "chrome/browser/extensions/component_loader.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "components/crx_file/id_util.h" | 33 #include "components/crx_file/id_util.h" |
| 34 #include "components/version_info/version_info.h" | 34 #include "components/version_info/version_info.h" |
| 35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
| 36 #include "content/public/browser/plugin_service.h" | 36 #include "content/public/browser/plugin_service.h" |
| 37 #include "content/public/common/content_switches.h" | 37 #include "content/public/common/content_switches.h" |
| 38 #include "extensions/common/constants.h" | 38 #include "extensions/common/constants.h" |
| 39 #include "extensions/common/extension.h" | 39 #include "extensions/common/extension.h" |
| 40 #include "extensions/common/extension_l10n_util.h" | 40 #include "extensions/common/extension_l10n_util.h" |
| 41 #include "extensions/common/file_util.h" | 41 #include "extensions/common/file_util.h" |
| 42 #include "extensions/common/manifest_constants.h" | 42 #include "extensions/common/manifest_constants.h" |
| 43 #include "ppapi/features/features.h" |
| 43 #include "printing/features/features.h" | 44 #include "printing/features/features.h" |
| 44 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
| 45 #include "ui/base/resource/resource_bundle.h" | 46 #include "ui/base/resource/resource_bundle.h" |
| 46 | 47 |
| 47 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
| 48 #include "ash/common/system/chromeos/devicetype_utils.h" | 49 #include "ash/common/system/chromeos/devicetype_utils.h" |
| 49 #include "chromeos/chromeos_switches.h" | 50 #include "chromeos/chromeos_switches.h" |
| 50 #include "components/chrome_apps/grit/chrome_apps_resources.h" | 51 #include "components/chrome_apps/grit/chrome_apps_resources.h" |
| 51 #include "components/user_manager/user_manager.h" | 52 #include "components/user_manager/user_manager.h" |
| 52 #include "content/public/browser/site_instance.h" | 53 #include "content/public/browser/site_instance.h" |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 488 |
| 488 if (!skip_session_components) { | 489 if (!skip_session_components) { |
| 489 AddWebStoreApp(); | 490 AddWebStoreApp(); |
| 490 AddChromeApp(); | 491 AddChromeApp(); |
| 491 } | 492 } |
| 492 | 493 |
| 493 AddKeyboardApp(); | 494 AddKeyboardApp(); |
| 494 | 495 |
| 495 AddDefaultComponentExtensionsWithBackgroundPages(skip_session_components); | 496 AddDefaultComponentExtensionsWithBackgroundPages(skip_session_components); |
| 496 | 497 |
| 497 #if defined(ENABLE_PLUGINS) | 498 #if BUILDFLAG(ENABLE_PLUGINS) |
| 498 Add(pdf_extension_util::GetManifest(), | 499 Add(pdf_extension_util::GetManifest(), |
| 499 base::FilePath(FILE_PATH_LITERAL("pdf"))); | 500 base::FilePath(FILE_PATH_LITERAL("pdf"))); |
| 500 #endif | 501 #endif |
| 501 } | 502 } |
| 502 | 503 |
| 503 void ComponentLoader::AddDefaultComponentExtensionsForKioskMode( | 504 void ComponentLoader::AddDefaultComponentExtensionsForKioskMode( |
| 504 bool skip_session_components) { | 505 bool skip_session_components) { |
| 505 // Do not add component extensions that have background pages here -- add them | 506 // Do not add component extensions that have background pages here -- add them |
| 506 // to AddDefaultComponentExtensionsWithBackgroundPagesForKioskMode. | 507 // to AddDefaultComponentExtensionsWithBackgroundPagesForKioskMode. |
| 507 | 508 |
| 508 // No component extension for kiosk app launch splash screen. | 509 // No component extension for kiosk app launch splash screen. |
| 509 if (skip_session_components) | 510 if (skip_session_components) |
| 510 return; | 511 return; |
| 511 | 512 |
| 512 // Component extensions needed for kiosk apps. | 513 // Component extensions needed for kiosk apps. |
| 513 AddFileManagerExtension(); | 514 AddFileManagerExtension(); |
| 514 | 515 |
| 515 // Add virtual keyboard. | 516 // Add virtual keyboard. |
| 516 AddKeyboardApp(); | 517 AddKeyboardApp(); |
| 517 | 518 |
| 518 AddDefaultComponentExtensionsWithBackgroundPagesForKioskMode(); | 519 AddDefaultComponentExtensionsWithBackgroundPagesForKioskMode(); |
| 519 | 520 |
| 520 #if defined(ENABLE_PLUGINS) | 521 #if BUILDFLAG(ENABLE_PLUGINS) |
| 521 Add(pdf_extension_util::GetManifest(), | 522 Add(pdf_extension_util::GetManifest(), |
| 522 base::FilePath(FILE_PATH_LITERAL("pdf"))); | 523 base::FilePath(FILE_PATH_LITERAL("pdf"))); |
| 523 #endif | 524 #endif |
| 524 } | 525 } |
| 525 | 526 |
| 526 void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages( | 527 void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages( |
| 527 bool skip_session_components) { | 528 bool skip_session_components) { |
| 528 const base::CommandLine* command_line = | 529 const base::CommandLine* command_line = |
| 529 base::CommandLine::ForCurrentProcess(); | 530 base::CommandLine::ForCurrentProcess(); |
| 530 | 531 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 return; // Error already logged. | 684 return; // Error already logged. |
| 684 std::string actual_extension_id = | 685 std::string actual_extension_id = |
| 685 Add(std::move(manifest), root_directory, false); | 686 Add(std::move(manifest), root_directory, false); |
| 686 CHECK_EQ(extension_id, actual_extension_id); | 687 CHECK_EQ(extension_id, actual_extension_id); |
| 687 if (!done_cb.is_null()) | 688 if (!done_cb.is_null()) |
| 688 done_cb.Run(); | 689 done_cb.Run(); |
| 689 } | 690 } |
| 690 #endif | 691 #endif |
| 691 | 692 |
| 692 } // namespace extensions | 693 } // namespace extensions |
| OLD | NEW |