| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 browser_context_(browser_context), | 126 browser_context_(browser_context), |
| 127 extension_service_(extension_service), | 127 extension_service_(extension_service), |
| 128 weak_factory_(this) {} | 128 weak_factory_(this) {} |
| 129 | 129 |
| 130 ComponentLoader::~ComponentLoader() { | 130 ComponentLoader::~ComponentLoader() { |
| 131 ClearAllRegistered(); | 131 ClearAllRegistered(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void ComponentLoader::LoadAll() { | 134 void ComponentLoader::LoadAll() { |
| 135 TRACE_EVENT0("browser,startup", "ComponentLoader::LoadAll"); | 135 TRACE_EVENT0("browser,startup", "ComponentLoader::LoadAll"); |
| 136 const base::TimeTicks start_time = base::TimeTicks::Now(); | 136 SCOPED_UMA_HISTOGRAM_TIMER("Extensions.LoadAllComponentTime"); |
| 137 |
| 137 for (RegisteredComponentExtensions::iterator it = | 138 for (RegisteredComponentExtensions::iterator it = |
| 138 component_extensions_.begin(); | 139 component_extensions_.begin(); |
| 139 it != component_extensions_.end(); ++it) { | 140 it != component_extensions_.end(); ++it) { |
| 140 Load(*it); | 141 Load(*it); |
| 141 } | 142 } |
| 142 UMA_HISTOGRAM_TIMES("Extensions.LoadAllComponentTime", | |
| 143 base::TimeTicks::Now() - start_time); | |
| 144 } | 143 } |
| 145 | 144 |
| 146 base::DictionaryValue* ComponentLoader::ParseManifest( | 145 base::DictionaryValue* ComponentLoader::ParseManifest( |
| 147 const std::string& manifest_contents) const { | 146 const std::string& manifest_contents) const { |
| 148 JSONStringValueSerializer serializer(manifest_contents); | 147 JSONStringValueSerializer serializer(manifest_contents); |
| 149 scoped_ptr<base::Value> manifest(serializer.Deserialize(NULL, NULL)); | 148 scoped_ptr<base::Value> manifest(serializer.Deserialize(NULL, NULL)); |
| 150 | 149 |
| 151 if (!manifest.get() || !manifest->IsType(base::Value::TYPE_DICTIONARY)) { | 150 if (!manifest.get() || !manifest->IsType(base::Value::TYPE_DICTIONARY)) { |
| 152 LOG(ERROR) << "Failed to parse extension manifest."; | 151 LOG(ERROR) << "Failed to parse extension manifest."; |
| 153 return NULL; | 152 return NULL; |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 off_the_record_context, Extension::GetBaseURLFromExtensionId(id)); | 672 off_the_record_context, Extension::GetBaseURLFromExtensionId(id)); |
| 674 storage::FileSystemContext* file_system_context = | 673 storage::FileSystemContext* file_system_context = |
| 675 content::BrowserContext::GetStoragePartitionForSite( | 674 content::BrowserContext::GetStoragePartitionForSite( |
| 676 off_the_record_context, site)->GetFileSystemContext(); | 675 off_the_record_context, site)->GetFileSystemContext(); |
| 677 file_system_context->EnableTemporaryFileSystemInIncognito(); | 676 file_system_context->EnableTemporaryFileSystemInIncognito(); |
| 678 } | 677 } |
| 679 #endif | 678 #endif |
| 680 } | 679 } |
| 681 | 680 |
| 682 } // namespace extensions | 681 } // namespace extensions |
| OLD | NEW |