| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef EXTENSIONS_BROWSER_UPDATER_UPDATE_INSTALL_SHIM_H_ | 5 #ifndef EXTENSIONS_BROWSER_UPDATER_UPDATE_INSTALL_SHIM_H_ |
| 6 #define EXTENSIONS_BROWSER_UPDATER_UPDATE_INSTALL_SHIM_H_ | 6 #define EXTENSIONS_BROWSER_UPDATER_UPDATE_INSTALL_SHIM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // of it to install. | 37 // of it to install. |
| 38 UpdateInstallShim(std::string extension_id, | 38 UpdateInstallShim(std::string extension_id, |
| 39 const base::FilePath& extension_root, | 39 const base::FilePath& extension_root, |
| 40 const UpdateInstallShimCallback& callback); | 40 const UpdateInstallShimCallback& callback); |
| 41 | 41 |
| 42 // Called when an update attempt failed. | 42 // Called when an update attempt failed. |
| 43 void OnUpdateError(int error) override; | 43 void OnUpdateError(int error) override; |
| 44 | 44 |
| 45 // This is called when a new version of an extension is unpacked at | 45 // This is called when a new version of an extension is unpacked at |
| 46 // |unpack_path| and is ready for install. | 46 // |unpack_path| and is ready for install. |
| 47 bool Install(const base::DictionaryValue& manifest, | 47 CrxInstaller::Result Install(const base::DictionaryValue& manifest, |
| 48 const base::FilePath& unpack_path) override; | 48 const base::FilePath& unpack_path) override; |
| 49 | 49 |
| 50 // This is called by the generic differential update code in the | 50 // This is called by the generic differential update code in the |
| 51 // update_client to provide the path to an existing file in the current | 51 // update_client to provide the path to an existing file in the current |
| 52 // version of the extension, so that it can be copied (or serve as the input | 52 // version of the extension, so that it can be copied (or serve as the input |
| 53 // to diff-patching) with output going to the directory with the new version | 53 // to diff-patching) with output going to the directory with the new version |
| 54 // being staged on disk for install. | 54 // being staged on disk for install. |
| 55 bool GetInstalledFile(const std::string& file, | 55 bool GetInstalledFile(const std::string& file, |
| 56 base::FilePath* installed_file) override; | 56 base::FilePath* installed_file) override; |
| 57 | 57 |
| 58 // This method is not relevant to extension updating. | 58 // This method is not relevant to extension updating. |
| 59 bool Uninstall() override; | 59 bool Uninstall() override; |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 friend class base::RefCountedThreadSafe<UpdateInstallShim>; | 62 friend class base::RefCountedThreadSafe<UpdateInstallShim>; |
| 63 ~UpdateInstallShim() override; | 63 ~UpdateInstallShim() override; |
| 64 | 64 |
| 65 // Takes ownership of the directory at path |temp_dir|. | 65 // Takes ownership of the directory at path |temp_dir|. |
| 66 void RunCallbackOnUIThread(const base::FilePath& temp_dir); | 66 void RunCallbackOnUIThread(const base::FilePath& temp_dir); |
| 67 | 67 |
| 68 std::string extension_id_; | 68 std::string extension_id_; |
| 69 base::FilePath extension_root_; | 69 base::FilePath extension_root_; |
| 70 UpdateInstallShimCallback callback_; | 70 UpdateInstallShimCallback callback_; |
| 71 | 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(UpdateInstallShim); | 72 DISALLOW_COPY_AND_ASSIGN(UpdateInstallShim); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 } // namespace extensions | 75 } // namespace extensions |
| 76 | 76 |
| 77 #endif // EXTENSIONS_BROWSER_UPDATER_UPDATE_INSTALL_SHIM_H_ | 77 #endif // EXTENSIONS_BROWSER_UPDATER_UPDATE_INSTALL_SHIM_H_ |
| OLD | NEW |