| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 COMPONENTS_UPDATE_CLIENT_COMPONENT_H_ | 5 #ifndef COMPONENTS_UPDATE_CLIENT_COMPONENT_H_ |
| 6 #define COMPONENTS_UPDATE_CLIENT_COMPONENT_H_ | 6 #define COMPONENTS_UPDATE_CLIENT_COMPONENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/threading/thread_checker.h" | 19 #include "base/threading/thread_checker.h" |
| 20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 #include "base/version.h" | 21 #include "base/version.h" |
| 22 #include "components/update_client/crx_downloader.h" | 22 #include "components/update_client/crx_downloader.h" |
| 23 #include "components/update_client/update_client.h" | 23 #include "components/update_client/update_client.h" |
| 24 #include "components/update_client/update_response.h" | 24 #include "components/update_client/update_response.h" |
| 25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 26 | 26 |
| 27 namespace base { | |
| 28 class SingleThreadTaskRunner; | |
| 29 } | |
| 30 | 27 |
| 31 namespace update_client { | 28 namespace update_client { |
| 32 | 29 |
| 33 struct CrxUpdateItem; | 30 struct CrxUpdateItem; |
| 34 class ComponentUnpacker; | |
| 35 struct UpdateContext; | 31 struct UpdateContext; |
| 36 | 32 |
| 37 // Describes a CRX component managed by the UpdateEngine. Each |Component| is | 33 // Describes a CRX component managed by the UpdateEngine. Each |Component| is |
| 38 // associated with an UpdateContext. | 34 // associated with an UpdateContext. |
| 39 class Component { | 35 class Component { |
| 40 public: | 36 public: |
| 41 using Events = UpdateClient::Observer::Events; | 37 using Events = UpdateClient::Observer::Events; |
| 42 | 38 |
| 43 using CallbackHandleComplete = base::Callback<void()>; | 39 using CallbackHandleComplete = base::Callback<void()>; |
| 44 | 40 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 public: | 309 public: |
| 314 explicit StateUpdating(Component* component); | 310 explicit StateUpdating(Component* component); |
| 315 ~StateUpdating() override; | 311 ~StateUpdating() override; |
| 316 | 312 |
| 317 private: | 313 private: |
| 318 // State overrides. | 314 // State overrides. |
| 319 void DoHandle() override; | 315 void DoHandle() override; |
| 320 | 316 |
| 321 void InstallComplete(int error_category, int error_code, int extra_code1); | 317 void InstallComplete(int error_category, int error_code, int extra_code1); |
| 322 | 318 |
| 323 // Posts replies back to the main thread. | |
| 324 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | |
| 325 | |
| 326 // Unpacks one CRX. | |
| 327 scoped_refptr<ComponentUnpacker> unpacker_; | |
| 328 | |
| 329 base::FilePath unpack_path_; | |
| 330 | |
| 331 DISALLOW_COPY_AND_ASSIGN(StateUpdating); | 319 DISALLOW_COPY_AND_ASSIGN(StateUpdating); |
| 332 }; | 320 }; |
| 333 | 321 |
| 334 class StateUpdated : public State { | 322 class StateUpdated : public State { |
| 335 public: | 323 public: |
| 336 explicit StateUpdated(Component* component); | 324 explicit StateUpdated(Component* component); |
| 337 ~StateUpdated() override; | 325 ~StateUpdated() override; |
| 338 | 326 |
| 339 private: | 327 private: |
| 340 // State overrides. | 328 // State overrides. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 base::Closure update_check_complete_; | 420 base::Closure update_check_complete_; |
| 433 | 421 |
| 434 DISALLOW_COPY_AND_ASSIGN(Component); | 422 DISALLOW_COPY_AND_ASSIGN(Component); |
| 435 }; | 423 }; |
| 436 | 424 |
| 437 using IdToComponentPtrMap = std::map<std::string, std::unique_ptr<Component>>; | 425 using IdToComponentPtrMap = std::map<std::string, std::unique_ptr<Component>>; |
| 438 | 426 |
| 439 } // namespace update_client | 427 } // namespace update_client |
| 440 | 428 |
| 441 #endif // COMPONENTS_UPDATE_CLIENT_COMPONENT_H_ | 429 #endif // COMPONENTS_UPDATE_CLIENT_COMPONENT_H_ |
| OLD | NEW |