| 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" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 store_factory_(new ValueStoreFactoryImpl(browser_context->GetPath())), | 38 store_factory_(new ValueStoreFactoryImpl(browser_context->GetPath())), |
| 39 weak_factory_(this) {} | 39 weak_factory_(this) {} |
| 40 | 40 |
| 41 ShellExtensionSystem::~ShellExtensionSystem() { | 41 ShellExtensionSystem::~ShellExtensionSystem() { |
| 42 } | 42 } |
| 43 | 43 |
| 44 const Extension* ShellExtensionSystem::LoadApp(const base::FilePath& app_dir) { | 44 const Extension* ShellExtensionSystem::LoadApp(const base::FilePath& app_dir) { |
| 45 // app_shell only supports unpacked extensions. | 45 // app_shell only supports unpacked extensions. |
| 46 // NOTE: If you add packed extension support consider removing the flag | 46 // NOTE: If you add packed extension support consider removing the flag |
| 47 // FOLLOW_SYMLINKS_ANYWHERE below. Packed extensions should not have symlinks. | 47 // FOLLOW_SYMLINKS_ANYWHERE below. Packed extensions should not have symlinks. |
| 48 CHECK(base::DirectoryExists(app_dir)) << app_dir.AsUTF8Unsafe(); | 48 CHECK(base::DirectoryExists(app_dir)); |
| 49 int load_flags = Extension::FOLLOW_SYMLINKS_ANYWHERE; | 49 int load_flags = Extension::FOLLOW_SYMLINKS_ANYWHERE; |
| 50 std::string load_error; | 50 std::string load_error; |
| 51 scoped_refptr<Extension> extension = file_util::LoadExtension( | 51 scoped_refptr<Extension> extension = file_util::LoadExtension( |
| 52 app_dir, Manifest::COMMAND_LINE, load_flags, &load_error); | 52 app_dir, Manifest::COMMAND_LINE, load_flags, &load_error); |
| 53 if (!extension.get()) { | 53 if (!extension.get()) { |
| 54 LOG(ERROR) << "Loading extension at " << app_dir.value() | 54 LOG(ERROR) << "Loading extension at " << app_dir.value() |
| 55 << " failed with: " << load_error; | 55 << " failed with: " << load_error; |
| 56 return nullptr; | 56 return nullptr; |
| 57 } | 57 } |
| 58 | 58 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 | 200 |
| 201 void ShellExtensionSystem::OnExtensionRegisteredWithRequestContexts( | 201 void ShellExtensionSystem::OnExtensionRegisteredWithRequestContexts( |
| 202 scoped_refptr<Extension> extension) { | 202 scoped_refptr<Extension> extension) { |
| 203 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_); | 203 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_); |
| 204 registry->AddReady(extension); | 204 registry->AddReady(extension); |
| 205 registry->TriggerOnReady(extension.get()); | 205 registry->TriggerOnReady(extension.get()); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace extensions | 208 } // namespace extensions |
| OLD | NEW |