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/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
| 13 #include "base/trace_event/trace_event.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/extensions/extension_action_manager.h" | 16 #include "chrome/browser/extensions/extension_action_manager.h" |
16 #include "chrome/browser/extensions/extension_error_reporter.h" | 17 #include "chrome/browser/extensions/extension_error_reporter.h" |
17 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
18 #include "chrome/browser/extensions/extension_util.h" | 19 #include "chrome/browser/extensions/extension_util.h" |
19 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/extensions/api/supervised_user_private/supervised_user_h
andler.h" | 22 #include "chrome/common/extensions/api/supervised_user_private/supervised_user_h
andler.h" |
22 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" | 23 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 return; | 222 return; |
222 } | 223 } |
223 | 224 |
224 if (write_to_prefs) | 225 if (write_to_prefs) |
225 extension_prefs_->UpdateManifest(extension.get()); | 226 extension_prefs_->UpdateManifest(extension.get()); |
226 | 227 |
227 extension_service_->AddExtension(extension.get()); | 228 extension_service_->AddExtension(extension.get()); |
228 } | 229 } |
229 | 230 |
230 void InstalledLoader::LoadAllExtensions() { | 231 void InstalledLoader::LoadAllExtensions() { |
| 232 TRACE_EVENT0("browser,startup", "InstalledLoader::LoadAllExtensions"); |
231 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 233 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
232 | 234 |
233 base::TimeTicks start_time = base::TimeTicks::Now(); | 235 base::TimeTicks start_time = base::TimeTicks::Now(); |
234 | 236 |
235 Profile* profile = extension_service_->profile(); | 237 Profile* profile = extension_service_->profile(); |
236 scoped_ptr<ExtensionPrefs::ExtensionsInfo> extensions_info( | 238 scoped_ptr<ExtensionPrefs::ExtensionsInfo> extensions_info( |
237 extension_prefs_->GetInstalledExtensionsInfo()); | 239 extension_prefs_->GetInstalledExtensionsInfo()); |
238 | 240 |
239 std::vector<int> reload_reason_counts(NUM_MANIFEST_RELOAD_REASONS, 0); | 241 std::vector<int> reload_reason_counts(NUM_MANIFEST_RELOAD_REASONS, 0); |
240 bool should_write_prefs = false; | 242 bool should_write_prefs = false; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { | 577 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { |
576 int flags = extension_prefs_->GetCreationFlags(info->extension_id); | 578 int flags = extension_prefs_->GetCreationFlags(info->extension_id); |
577 if (!Manifest::IsUnpackedLocation(info->extension_location)) | 579 if (!Manifest::IsUnpackedLocation(info->extension_location)) |
578 flags |= Extension::REQUIRE_KEY; | 580 flags |= Extension::REQUIRE_KEY; |
579 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 581 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
580 flags |= Extension::ALLOW_FILE_ACCESS; | 582 flags |= Extension::ALLOW_FILE_ACCESS; |
581 return flags; | 583 return flags; |
582 } | 584 } |
583 | 585 |
584 } // namespace extensions | 586 } // namespace extensions |
OLD | NEW |