| 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 #include "components/update_client/update_engine.h" | 5 #include "components/update_client/update_engine.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 std::unique_ptr<UpdateContext> update_context(new UpdateContext( | 93 std::unique_ptr<UpdateContext> update_context(new UpdateContext( |
| 94 config_, is_foreground, ids, crx_data_callback, | 94 config_, is_foreground, ids, crx_data_callback, |
| 95 notify_observers_callback_, callback, update_checker_factory_, | 95 notify_observers_callback_, callback, update_checker_factory_, |
| 96 crx_downloader_factory_, ping_manager_)); | 96 crx_downloader_factory_, ping_manager_)); |
| 97 | 97 |
| 98 CrxUpdateItem update_item; | 98 CrxUpdateItem update_item; |
| 99 std::unique_ptr<ActionUpdateCheck> update_check_action(new ActionUpdateCheck( | 99 std::unique_ptr<ActionUpdateCheck> update_check_action(new ActionUpdateCheck( |
| 100 (*update_context->update_checker_factory)(config_, metadata_.get()), | 100 (*update_context->update_checker_factory)(config_, metadata_.get()), |
| 101 config_->GetBrowserVersion(), config_->ExtraRequestParams())); | 101 config_->GetBrowserVersion(), config_->ExtraRequestParams())); |
| 102 | 102 |
| 103 update_context->current_action.reset(update_check_action.release()); | 103 update_context->current_action = std::move(update_check_action); |
| 104 update_contexts_.insert(update_context.get()); | 104 update_contexts_.insert(update_context.get()); |
| 105 | 105 |
| 106 update_context->current_action->Run( | 106 update_context->current_action->Run( |
| 107 update_context.get(), | 107 update_context.get(), |
| 108 base::Bind(&UpdateEngine::UpdateComplete, base::Unretained(this), | 108 base::Bind(&UpdateEngine::UpdateComplete, base::Unretained(this), |
| 109 update_context.get())); | 109 update_context.get())); |
| 110 | 110 |
| 111 ignore_result(update_context.release()); | 111 ignore_result(update_context.release()); |
| 112 } | 112 } |
| 113 | 113 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 142 | 142 |
| 143 const auto now(base::TimeTicks::Now()); | 143 const auto now(base::TimeTicks::Now()); |
| 144 | 144 |
| 145 // Throttle the calls in the interval (t - 1 day, t) to limit the effect of | 145 // Throttle the calls in the interval (t - 1 day, t) to limit the effect of |
| 146 // unset clocks or clock drift. | 146 // unset clocks or clock drift. |
| 147 return throttle_updates_until_ - base::TimeDelta::FromDays(1) < now && | 147 return throttle_updates_until_ - base::TimeDelta::FromDays(1) < now && |
| 148 now < throttle_updates_until_; | 148 now < throttle_updates_until_; |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace update_client | 151 } // namespace update_client |
| OLD | NEW |