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 <stddef.h> | 7 #include <stddef.h> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 24 matching lines...) Expand all Loading... | |
35 #include "extensions/common/extension.h" | 35 #include "extensions/common/extension.h" |
36 #include "extensions/common/extension_l10n_util.h" | 36 #include "extensions/common/extension_l10n_util.h" |
37 #include "extensions/common/extension_set.h" | 37 #include "extensions/common/extension_set.h" |
38 #include "extensions/common/extension_urls.h" | 38 #include "extensions/common/extension_urls.h" |
39 #include "extensions/common/file_util.h" | 39 #include "extensions/common/file_util.h" |
40 #include "extensions/common/manifest.h" | 40 #include "extensions/common/manifest.h" |
41 #include "extensions/common/manifest_constants.h" | 41 #include "extensions/common/manifest_constants.h" |
42 #include "extensions/common/manifest_handlers/background_info.h" | 42 #include "extensions/common/manifest_handlers/background_info.h" |
43 #include "extensions/common/manifest_url_handlers.h" | 43 #include "extensions/common/manifest_url_handlers.h" |
44 | 44 |
45 #if defined(OS_CHROMEOS) | |
46 #include "chrome/browser/chromeos/profiles/profile_helper.h" | |
47 #endif | |
48 | |
45 using base::UserMetricsAction; | 49 using base::UserMetricsAction; |
46 using content::BrowserThread; | 50 using content::BrowserThread; |
47 | 51 |
48 namespace extensions { | 52 namespace extensions { |
49 | 53 |
50 namespace errors = manifest_errors; | 54 namespace errors = manifest_errors; |
51 | 55 |
52 namespace { | 56 namespace { |
53 | 57 |
54 // The following enumeration is used in histograms matching | 58 // The following enumeration is used in histograms matching |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
300 } | 304 } |
301 | 305 |
302 extensions_info->at(i)->extension_manifest.reset( | 306 extensions_info->at(i)->extension_manifest.reset( |
303 static_cast<base::DictionaryValue*>( | 307 static_cast<base::DictionaryValue*>( |
304 extension->manifest()->value()->DeepCopy())); | 308 extension->manifest()->value()->DeepCopy())); |
305 should_write_prefs = true; | 309 should_write_prefs = true; |
306 } | 310 } |
307 } | 311 } |
308 | 312 |
309 for (size_t i = 0; i < extensions_info->size(); ++i) { | 313 for (size_t i = 0; i < extensions_info->size(); ++i) { |
310 if (extensions_info->at(i)->extension_location != Manifest::COMMAND_LINE) | 314 // Don't load saved extensions from the command line. |
315 bool should_load = | |
316 extensions_info->at(i)->extension_location != Manifest::COMMAND_LINE; | |
317 #if defined(OS_CHROMEOS) | |
318 // Also don't load saved extensions in the signin profile. | |
319 if (chromeos::ProfileHelper::IsSigninProfile(profile)) | |
Devlin
2017/03/17 16:37:23
We should just early out of this whole function, o
achuithb
2017/03/22 00:15:53
Done.
| |
320 should_load = false; | |
321 #endif | |
322 if (should_load) | |
311 Load(*extensions_info->at(i), should_write_prefs); | 323 Load(*extensions_info->at(i), should_write_prefs); |
312 } | 324 } |
313 | 325 |
314 extension_service_->OnLoadedInstalledExtensions(); | 326 extension_service_->OnLoadedInstalledExtensions(); |
315 | 327 |
316 // The histograms Extensions.ManifestReload* allow us to validate | 328 // The histograms Extensions.ManifestReload* allow us to validate |
317 // the assumption that reloading manifest is a rare event. | 329 // the assumption that reloading manifest is a rare event. |
318 UMA_HISTOGRAM_COUNTS_100("Extensions.ManifestReloadNotNeeded", | 330 UMA_HISTOGRAM_COUNTS_100("Extensions.ManifestReloadNotNeeded", |
319 reload_reason_counts[NOT_NEEDED]); | 331 reload_reason_counts[NOT_NEEDED]); |
320 UMA_HISTOGRAM_COUNTS_100("Extensions.ManifestReloadUnpackedDir", | 332 UMA_HISTOGRAM_COUNTS_100("Extensions.ManifestReloadUnpackedDir", |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
626 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { | 638 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { |
627 int flags = extension_prefs_->GetCreationFlags(info->extension_id); | 639 int flags = extension_prefs_->GetCreationFlags(info->extension_id); |
628 if (!Manifest::IsUnpackedLocation(info->extension_location)) | 640 if (!Manifest::IsUnpackedLocation(info->extension_location)) |
629 flags |= Extension::REQUIRE_KEY; | 641 flags |= Extension::REQUIRE_KEY; |
630 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 642 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
631 flags |= Extension::ALLOW_FILE_ACCESS; | 643 flags |= Extension::ALLOW_FILE_ACCESS; |
632 return flags; | 644 return flags; |
633 } | 645 } |
634 | 646 |
635 } // namespace extensions | 647 } // namespace extensions |
OLD | NEW |