| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_extension_system.h" | 5 #include "extensions/shell/browser/shell_extension_system.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/notification_details.h" | 13 #include "content/public/browser/notification_details.h" |
| 14 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
| 15 #include "content/public/browser/notification_source.h" | 15 #include "content/public/browser/notification_source.h" |
| 16 #include "extensions/browser/api/app_runtime/app_runtime_api.h" | 16 #include "extensions/browser/api/app_runtime/app_runtime_api.h" |
| 17 #include "extensions/browser/extension_prefs.h" | 17 #include "extensions/browser/extension_prefs.h" |
| 18 #include "extensions/browser/extension_registry.h" | 18 #include "extensions/browser/extension_registry.h" |
| 19 #include "extensions/browser/info_map.h" | 19 #include "extensions/browser/info_map.h" |
| 20 #include "extensions/browser/notification_types.h" | 20 #include "extensions/browser/notification_types.h" |
| 21 #include "extensions/browser/null_app_sorting.h" |
| 21 #include "extensions/browser/quota_service.h" | 22 #include "extensions/browser/quota_service.h" |
| 22 #include "extensions/browser/runtime_data.h" | 23 #include "extensions/browser/runtime_data.h" |
| 23 #include "extensions/common/constants.h" | 24 #include "extensions/common/constants.h" |
| 24 #include "extensions/common/file_util.h" | 25 #include "extensions/common/file_util.h" |
| 25 | 26 |
| 26 using content::BrowserContext; | 27 using content::BrowserContext; |
| 27 using content::BrowserThread; | 28 using content::BrowserThread; |
| 28 | 29 |
| 29 namespace extensions { | 30 namespace extensions { |
| 30 | 31 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 browser_context_, extension, extensions::SOURCE_UNTRACKED); | 94 browser_context_, extension, extensions::SOURCE_UNTRACKED); |
| 94 } | 95 } |
| 95 | 96 |
| 96 void ShellExtensionSystem::Shutdown() { | 97 void ShellExtensionSystem::Shutdown() { |
| 97 } | 98 } |
| 98 | 99 |
| 99 void ShellExtensionSystem::InitForRegularProfile(bool extensions_enabled) { | 100 void ShellExtensionSystem::InitForRegularProfile(bool extensions_enabled) { |
| 100 runtime_data_.reset( | 101 runtime_data_.reset( |
| 101 new RuntimeData(ExtensionRegistry::Get(browser_context_))); | 102 new RuntimeData(ExtensionRegistry::Get(browser_context_))); |
| 102 quota_service_.reset(new QuotaService); | 103 quota_service_.reset(new QuotaService); |
| 104 app_sorting_.reset(new NullAppSorting); |
| 103 } | 105 } |
| 104 | 106 |
| 105 ExtensionService* ShellExtensionSystem::extension_service() { | 107 ExtensionService* ShellExtensionSystem::extension_service() { |
| 106 return nullptr; | 108 return nullptr; |
| 107 } | 109 } |
| 108 | 110 |
| 109 RuntimeData* ShellExtensionSystem::runtime_data() { | 111 RuntimeData* ShellExtensionSystem::runtime_data() { |
| 110 return runtime_data_.get(); | 112 return runtime_data_.get(); |
| 111 } | 113 } |
| 112 | 114 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 129 InfoMap* ShellExtensionSystem::info_map() { | 131 InfoMap* ShellExtensionSystem::info_map() { |
| 130 if (!info_map_.get()) | 132 if (!info_map_.get()) |
| 131 info_map_ = new InfoMap; | 133 info_map_ = new InfoMap; |
| 132 return info_map_.get(); | 134 return info_map_.get(); |
| 133 } | 135 } |
| 134 | 136 |
| 135 QuotaService* ShellExtensionSystem::quota_service() { | 137 QuotaService* ShellExtensionSystem::quota_service() { |
| 136 return quota_service_.get(); | 138 return quota_service_.get(); |
| 137 } | 139 } |
| 138 | 140 |
| 141 AppSorting* ShellExtensionSystem::app_sorting() { |
| 142 return app_sorting_.get(); |
| 143 } |
| 144 |
| 139 void ShellExtensionSystem::RegisterExtensionWithRequestContexts( | 145 void ShellExtensionSystem::RegisterExtensionWithRequestContexts( |
| 140 const Extension* extension, | 146 const Extension* extension, |
| 141 const base::Closure& callback) { | 147 const base::Closure& callback) { |
| 142 BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE, | 148 BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE, |
| 143 base::Bind(&InfoMap::AddExtension, info_map(), | 149 base::Bind(&InfoMap::AddExtension, info_map(), |
| 144 make_scoped_refptr(extension), | 150 make_scoped_refptr(extension), |
| 145 base::Time::Now(), false, false), | 151 base::Time::Now(), false, false), |
| 146 callback); | 152 callback); |
| 147 } | 153 } |
| 148 | 154 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 165 } | 171 } |
| 166 | 172 |
| 167 void ShellExtensionSystem::OnExtensionRegisteredWithRequestContexts( | 173 void ShellExtensionSystem::OnExtensionRegisteredWithRequestContexts( |
| 168 scoped_refptr<Extension> extension) { | 174 scoped_refptr<Extension> extension) { |
| 169 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_); | 175 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_); |
| 170 registry->AddReady(extension); | 176 registry->AddReady(extension); |
| 171 registry->TriggerOnReady(extension.get()); | 177 registry->TriggerOnReady(extension.get()); |
| 172 } | 178 } |
| 173 | 179 |
| 174 } // namespace extensions | 180 } // namespace extensions |
| OLD | NEW |