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/installed_loader.h" | 5 #include "chrome/browser/extensions/installed_loader.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" | 22 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" |
23 #include "components/crx_file/id_util.h" | 23 #include "components/crx_file/id_util.h" |
24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
25 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
26 #include "content/public/browser/user_metrics.h" | 26 #include "content/public/browser/user_metrics.h" |
27 #include "extensions/browser/event_router.h" | 27 #include "extensions/browser/event_router.h" |
28 #include "extensions/browser/extension_prefs.h" | 28 #include "extensions/browser/extension_prefs.h" |
29 #include "extensions/browser/extension_registry.h" | 29 #include "extensions/browser/extension_registry.h" |
30 #include "extensions/browser/extension_system.h" | 30 #include "extensions/browser/extension_system.h" |
| 31 #include "extensions/browser/extension_util.h" |
31 #include "extensions/browser/management_policy.h" | 32 #include "extensions/browser/management_policy.h" |
32 #include "extensions/common/extension.h" | 33 #include "extensions/common/extension.h" |
33 #include "extensions/common/extension_l10n_util.h" | 34 #include "extensions/common/extension_l10n_util.h" |
34 #include "extensions/common/extension_set.h" | 35 #include "extensions/common/extension_set.h" |
35 #include "extensions/common/extension_urls.h" | 36 #include "extensions/common/extension_urls.h" |
36 #include "extensions/common/file_util.h" | 37 #include "extensions/common/file_util.h" |
37 #include "extensions/common/manifest.h" | 38 #include "extensions/common/manifest.h" |
38 #include "extensions/common/manifest_constants.h" | 39 #include "extensions/common/manifest_constants.h" |
39 #include "extensions/common/manifest_handlers/background_info.h" | 40 #include "extensions/common/manifest_handlers/background_info.h" |
40 #include "extensions/common/manifest_url_handlers.h" | 41 #include "extensions/common/manifest_url_handlers.h" |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 | 505 |
505 RecordCreationFlags(extension); | 506 RecordCreationFlags(extension); |
506 | 507 |
507 ExtensionService::RecordPermissionMessagesHistogram(extension, "Load"); | 508 ExtensionService::RecordPermissionMessagesHistogram(extension, "Load"); |
508 | 509 |
509 // For incognito and file access, skip anything that doesn't appear in | 510 // For incognito and file access, skip anything that doesn't appear in |
510 // settings. Also, policy-installed (and unpacked of course, checked above) | 511 // settings. Also, policy-installed (and unpacked of course, checked above) |
511 // extensions are boring. | 512 // extensions are boring. |
512 if (extension->ShouldDisplayInExtensionSettings() && | 513 if (extension->ShouldDisplayInExtensionSettings() && |
513 !Manifest::IsPolicyLocation(extension->location())) { | 514 !Manifest::IsPolicyLocation(extension->location())) { |
514 if (extension->can_be_incognito_enabled()) { | 515 if (util::CanBeIncognitoEnabled(extension)) { |
515 if (util::IsIncognitoEnabled(extension->id(), profile)) | 516 if (util::IsIncognitoEnabled(extension->id(), profile)) |
516 ++incognito_allowed_count; | 517 ++incognito_allowed_count; |
517 else | 518 else |
518 ++incognito_not_allowed_count; | 519 ++incognito_not_allowed_count; |
519 } | 520 } |
520 if (extension->wants_file_access()) { | 521 if (extension->wants_file_access()) { |
521 if (util::AllowFileAccess(extension->id(), profile)) | 522 if (util::AllowFileAccess(extension->id(), profile)) |
522 ++file_access_allowed_count; | 523 ++file_access_allowed_count; |
523 else | 524 else |
524 ++file_access_not_allowed_count; | 525 ++file_access_not_allowed_count; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { | 616 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { |
616 int flags = extension_prefs_->GetCreationFlags(info->extension_id); | 617 int flags = extension_prefs_->GetCreationFlags(info->extension_id); |
617 if (!Manifest::IsUnpackedLocation(info->extension_location)) | 618 if (!Manifest::IsUnpackedLocation(info->extension_location)) |
618 flags |= Extension::REQUIRE_KEY; | 619 flags |= Extension::REQUIRE_KEY; |
619 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 620 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
620 flags |= Extension::ALLOW_FILE_ACCESS; | 621 flags |= Extension::ALLOW_FILE_ACCESS; |
621 return flags; | 622 return flags; |
622 } | 623 } |
623 | 624 |
624 } // namespace extensions | 625 } // namespace extensions |
OLD | NEW |