OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef EXTENSIONS_BROWSER_UPDATER_UPDATE_DATA_PROVIDER_H_ |
| 6 #define EXTENSIONS_BROWSER_UPDATER_UPDATE_DATA_PROVIDER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/callback.h" |
| 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" |
| 14 |
| 15 namespace base { |
| 16 class FilePath; |
| 17 } |
| 18 |
| 19 namespace content { |
| 20 class BrowserContext; |
| 21 } |
| 22 |
| 23 namespace update_client { |
| 24 struct CrxComponent; |
| 25 } |
| 26 |
| 27 namespace extensions { |
| 28 |
| 29 // This class exists to let an UpdateClient retrieve information about a set of |
| 30 // extensions it is doing an update check for. |
| 31 class UpdateDataProvider : public base::RefCounted<UpdateDataProvider> { |
| 32 public: |
| 33 typedef base::Callback<void(content::BrowserContext* context, |
| 34 const std::string& /* extension_id */, |
| 35 const base::FilePath& /* temp_dir */)> |
| 36 InstallCallback; |
| 37 |
| 38 // We need a browser context to use when retrieving data for a set of |
| 39 // extension ids, as well as a callback for proceeding with installation |
| 40 // steps once the UpdateClient has downloaded and unpacked an update for an |
| 41 // extension. |
| 42 UpdateDataProvider(content::BrowserContext* context, |
| 43 const InstallCallback& callback); |
| 44 |
| 45 // Notify this object that the associated browser context is being shut down |
| 46 // the pointer to the context should be dropped and no more work should be |
| 47 // done. |
| 48 void Shutdown(); |
| 49 |
| 50 // Matches update_client::UpdateClient::CrxDataCallback |
| 51 void GetData(const std::vector<std::string>& ids, |
| 52 std::vector<update_client::CrxComponent>* data); |
| 53 |
| 54 private: |
| 55 friend class base::RefCounted<UpdateDataProvider>; |
| 56 ~UpdateDataProvider(); |
| 57 |
| 58 void RunInstallCallback(const std::string& extension_id, |
| 59 const base::FilePath& temp_dir); |
| 60 |
| 61 content::BrowserContext* context_; |
| 62 InstallCallback callback_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(UpdateDataProvider); |
| 65 }; |
| 66 |
| 67 } // namespace extensions |
| 68 |
| 69 #endif // EXTENSIONS_BROWSER_UPDATER_UPDATE_DATA_PROVIDER_H_ |
OLD | NEW |