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.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "base/threading/thread_restrictions.h" | 11 #include "base/threading/thread_restrictions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/extensions/api/runtime/runtime_api.h" | 14 #include "chrome/browser/extensions/api/runtime/runtime_api.h" |
15 #include "chrome/browser/extensions/extension_action_manager.h" | 15 #include "chrome/browser/extensions/extension_action_manager.h" |
16 #include "chrome/browser/extensions/extension_prefs.h" | 16 #include "chrome/browser/extensions/extension_prefs.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/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/extensions/api/managed_mode_private/managed_mode_handler
.h" | 22 #include "chrome/common/extensions/api/managed_mode_private/managed_mode_handler
.h" |
23 #include "chrome/common/extensions/background_info.h" | 23 #include "chrome/common/extensions/background_info.h" |
24 #include "chrome/common/extensions/extension.h" | 24 #include "chrome/common/extensions/extension.h" |
25 #include "chrome/common/extensions/extension_file_util.h" | 25 #include "chrome/common/extensions/extension_file_util.h" |
26 #include "chrome/common/extensions/extension_l10n_util.h" | 26 #include "chrome/common/extensions/extension_l10n_util.h" |
27 #include "chrome/common/extensions/extension_manifest_constants.h" | |
28 #include "chrome/common/extensions/manifest_url_handler.h" | 27 #include "chrome/common/extensions/manifest_url_handler.h" |
29 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
30 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
31 #include "content/public/browser/user_metrics.h" | 30 #include "content/public/browser/user_metrics.h" |
32 #include "extensions/common/manifest.h" | 31 #include "extensions/common/manifest.h" |
| 32 #include "extensions/common/manifest_constants.h" |
33 | 33 |
34 using content::BrowserThread; | 34 using content::BrowserThread; |
35 using content::UserMetricsAction; | 35 using content::UserMetricsAction; |
36 using extensions::Extension; | |
37 using extensions::ExtensionInfo; | |
38 using extensions::Manifest; | |
39 | |
40 namespace errors = extension_manifest_errors; | |
41 | 36 |
42 namespace extensions { | 37 namespace extensions { |
43 | 38 |
| 39 namespace errors = manifest_errors; |
| 40 |
44 namespace { | 41 namespace { |
45 | 42 |
46 // The following enumeration is used in histograms matching | 43 // The following enumeration is used in histograms matching |
47 // Extensions.ManifestReload* . Values may be added, as long as existing | 44 // Extensions.ManifestReload* . Values may be added, as long as existing |
48 // values are not changed. | 45 // values are not changed. |
49 enum ManifestReloadReason { | 46 enum ManifestReloadReason { |
50 NOT_NEEDED = 0, // Reload not needed. | 47 NOT_NEEDED = 0, // Reload not needed. |
51 UNPACKED_DIR, // Unpacked directory. | 48 UNPACKED_DIR, // Unpacked directory. |
52 NEEDS_RELOCALIZATION, // The locale has changed since we read this extension. | 49 NEEDS_RELOCALIZATION, // The locale has changed since we read this extension. |
53 CORRUPT_PREFERENCES, // The manifest in the preferences is corrupt. | 50 CORRUPT_PREFERENCES, // The manifest in the preferences is corrupt. |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { | 482 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { |
486 int flags = extension_prefs_->GetCreationFlags(info->extension_id); | 483 int flags = extension_prefs_->GetCreationFlags(info->extension_id); |
487 if (!Manifest::IsUnpackedLocation(info->extension_location)) | 484 if (!Manifest::IsUnpackedLocation(info->extension_location)) |
488 flags |= Extension::REQUIRE_KEY; | 485 flags |= Extension::REQUIRE_KEY; |
489 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 486 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
490 flags |= Extension::ALLOW_FILE_ACCESS; | 487 flags |= Extension::ALLOW_FILE_ACCESS; |
491 return flags; | 488 return flags; |
492 } | 489 } |
493 | 490 |
494 } // namespace extensions | 491 } // namespace extensions |
OLD | NEW |