Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: extensions/shell/browser/shell_extension_system.cc

Issue 412713002: Move apps/shell to extensions/shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 40% Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "apps/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 "apps/shell/browser/api/shell/shell_api.h"
10 #include "base/file_util.h" 9 #include "base/file_util.h"
11 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
12 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
13 #include "content/public/browser/browser_context.h" 12 #include "content/public/browser/browser_context.h"
14 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/notification_details.h" 14 #include "content/public/browser/notification_details.h"
16 #include "content/public/browser/notification_service.h" 15 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/notification_source.h" 16 #include "content/public/browser/notification_source.h"
18 #include "extensions/browser/api/app_runtime/app_runtime_api.h" 17 #include "extensions/browser/api/app_runtime/app_runtime_api.h"
19 #include "extensions/browser/event_router.h" 18 #include "extensions/browser/event_router.h"
20 #include "extensions/browser/extension_prefs.h" 19 #include "extensions/browser/extension_prefs.h"
21 #include "extensions/browser/extension_registry.h" 20 #include "extensions/browser/extension_registry.h"
22 #include "extensions/browser/info_map.h" 21 #include "extensions/browser/info_map.h"
23 #include "extensions/browser/lazy_background_task_queue.h" 22 #include "extensions/browser/lazy_background_task_queue.h"
24 #include "extensions/browser/process_manager.h" 23 #include "extensions/browser/process_manager.h"
25 #include "extensions/browser/quota_service.h" 24 #include "extensions/browser/quota_service.h"
26 #include "extensions/browser/runtime_data.h" 25 #include "extensions/browser/runtime_data.h"
27 #include "extensions/common/file_util.h" 26 #include "extensions/common/file_util.h"
27 #include "extensions/shell/browser/api/shell/shell_api.h"
28 28
29 using content::BrowserContext; 29 using content::BrowserContext;
30 using content::BrowserThread; 30 using content::BrowserThread;
31 31
32 namespace extensions { 32 namespace extensions {
33 33
34 ShellExtensionSystem::ShellExtensionSystem(BrowserContext* browser_context) 34 ShellExtensionSystem::ShellExtensionSystem(BrowserContext* browser_context)
35 : browser_context_(browser_context) { 35 : browser_context_(browser_context) {
36 } 36 }
37 37
38 ShellExtensionSystem::~ShellExtensionSystem() { 38 ShellExtensionSystem::~ShellExtensionSystem() {
39 } 39 }
40 40
41 bool ShellExtensionSystem::LoadApp(const base::FilePath& app_dir) { 41 bool ShellExtensionSystem::LoadApp(const base::FilePath& app_dir) {
42 // app_shell only supports unpacked extensions. 42 // app_shell only supports unpacked extensions.
43 // NOTE: If you add packed extension support consider removing the flag 43 // NOTE: If you add packed extension support consider removing the flag
44 // FOLLOW_SYMLINKS_ANYWHERE below. Packed extensions should not have symlinks. 44 // FOLLOW_SYMLINKS_ANYWHERE below. Packed extensions should not have symlinks.
45 CHECK(base::DirectoryExists(app_dir)) << app_dir.AsUTF8Unsafe(); 45 CHECK(base::DirectoryExists(app_dir)) << app_dir.AsUTF8Unsafe();
46 int load_flags = Extension::FOLLOW_SYMLINKS_ANYWHERE; 46 int load_flags = Extension::FOLLOW_SYMLINKS_ANYWHERE;
47 std::string load_error; 47 std::string load_error;
48 extension_ = file_util::LoadExtension( 48 extension_ = file_util::LoadExtension(
49 app_dir, Manifest::COMMAND_LINE, load_flags, &load_error); 49 app_dir, Manifest::COMMAND_LINE, load_flags, &load_error);
50 if (!extension_) { 50 if (!extension_) {
51 LOG(ERROR) << "Loading extension at " << app_dir.value() 51 LOG(ERROR) << "Loading extension at " << app_dir.value()
52 << " failed with: " << load_error; 52 << " failed with: " << load_error;
53 return false; 53 return false;
54 } 54 }
55 app_id_ = extension_->id(); 55 app_id_ = extension_->id();
56 56
57 // TODO(jamescook): We may want to do some of these things here: 57 // TODO(jamescook): We may want to do some of these things here:
58 // * Create a PermissionsUpdater. 58 // * Create a PermissionsUpdater.
59 // * Call PermissionsUpdater::GrantActivePermissions(). 59 // * Call PermissionsUpdater::GrantActivePermissions().
60 // * Call ExtensionService::SatisfyImports(). 60 // * Call ExtensionService::SatisfyImports().
61 // * Call ExtensionPrefs::OnExtensionInstalled(). 61 // * Call ExtensionPrefs::OnExtensionInstalled().
62 // * Send NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED. 62 // * Send NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 InstallVerifier* ShellExtensionSystem::install_verifier() { 157 InstallVerifier* ShellExtensionSystem::install_verifier() {
158 return NULL; 158 return NULL;
159 } 159 }
160 160
161 QuotaService* ShellExtensionSystem::quota_service() { 161 QuotaService* ShellExtensionSystem::quota_service() {
162 return quota_service_.get(); 162 return quota_service_.get();
163 } 163 }
164 164
165 void ShellExtensionSystem::RegisterExtensionWithRequestContexts( 165 void ShellExtensionSystem::RegisterExtensionWithRequestContexts(
166 const Extension* extension) { 166 const Extension* extension) {
167 BrowserThread::PostTask( 167 BrowserThread::PostTask(BrowserThread::IO,
168 BrowserThread::IO, FROM_HERE, 168 FROM_HERE,
169 base::Bind(&InfoMap::AddExtension, info_map(), 169 base::Bind(&InfoMap::AddExtension,
170 make_scoped_refptr(extension), base::Time::Now(), 170 info_map(),
171 false, false)); 171 make_scoped_refptr(extension),
172 base::Time::Now(),
173 false,
174 false));
172 } 175 }
173 176
174 void ShellExtensionSystem::UnregisterExtensionWithRequestContexts( 177 void ShellExtensionSystem::UnregisterExtensionWithRequestContexts(
175 const std::string& extension_id, 178 const std::string& extension_id,
176 const UnloadedExtensionInfo::Reason reason) { 179 const UnloadedExtensionInfo::Reason reason) {
177 } 180 }
178 181
179 const OneShotEvent& ShellExtensionSystem::ready() const { 182 const OneShotEvent& ShellExtensionSystem::ready() const {
180 return ready_; 183 return ready_;
181 } 184 }
182 185
183 ContentVerifier* ShellExtensionSystem::content_verifier() { 186 ContentVerifier* ShellExtensionSystem::content_verifier() {
184 return NULL; 187 return NULL;
185 } 188 }
186 189
187 scoped_ptr<ExtensionSet> ShellExtensionSystem::GetDependentExtensions( 190 scoped_ptr<ExtensionSet> ShellExtensionSystem::GetDependentExtensions(
188 const Extension* extension) { 191 const Extension* extension) {
189 scoped_ptr<ExtensionSet> empty(new ExtensionSet()); 192 scoped_ptr<ExtensionSet> empty(new ExtensionSet());
190 return empty.PassAs<ExtensionSet>(); 193 return empty.PassAs<ExtensionSet>();
191 } 194 }
192 195
193 } // namespace extensions 196 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/shell/browser/shell_extension_system.h ('k') | extensions/shell/browser/shell_extension_system_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698