| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 59 // Log warnings. |
| 60 if (extension->install_warnings().size()) { |
| 61 LOG(WARNING) << "Warnings loading extension at " << app_dir.value() << ":"; |
| 62 for (const auto& warning : extension->install_warnings()) |
| 63 LOG(WARNING) << warning.message; |
| 64 } |
| 65 |
| 59 // TODO(jamescook): We may want to do some of these things here: | 66 // TODO(jamescook): We may want to do some of these things here: |
| 60 // * Create a PermissionsUpdater. | 67 // * Create a PermissionsUpdater. |
| 61 // * Call PermissionsUpdater::GrantActivePermissions(). | 68 // * Call PermissionsUpdater::GrantActivePermissions(). |
| 62 // * Call ExtensionService::SatisfyImports(). | 69 // * Call ExtensionService::SatisfyImports(). |
| 63 // * Call ExtensionPrefs::OnExtensionInstalled(). | 70 // * Call ExtensionPrefs::OnExtensionInstalled(). |
| 64 // * Call ExtensionRegistryObserver::OnExtensionWillbeInstalled(). | 71 // * Call ExtensionRegistryObserver::OnExtensionWillbeInstalled(). |
| 65 | 72 |
| 66 ExtensionRegistry::Get(browser_context_)->AddEnabled(extension.get()); | 73 ExtensionRegistry::Get(browser_context_)->AddEnabled(extension.get()); |
| 67 | 74 |
| 68 RegisterExtensionWithRequestContexts( | 75 RegisterExtensionWithRequestContexts( |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 199 } |
| 193 | 200 |
| 194 void ShellExtensionSystem::OnExtensionRegisteredWithRequestContexts( | 201 void ShellExtensionSystem::OnExtensionRegisteredWithRequestContexts( |
| 195 scoped_refptr<Extension> extension) { | 202 scoped_refptr<Extension> extension) { |
| 196 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_); | 203 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_); |
| 197 registry->AddReady(extension); | 204 registry->AddReady(extension); |
| 198 registry->TriggerOnReady(extension.get()); | 205 registry->TriggerOnReady(extension.get()); |
| 199 } | 206 } |
| 200 | 207 |
| 201 } // namespace extensions | 208 } // namespace extensions |
| OLD | NEW |