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 "chrome/browser/extensions/extension_install_checker.h" | 5 #include "chrome/browser/extensions/extension_install_checker.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/blacklist.h" | 8 #include "chrome/browser/extensions/blacklist.h" |
9 #include "chrome/browser/extensions/requirements_checker.h" | 9 #include "chrome/browser/extensions/requirements_checker.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 failed_mask |= CHECK_MANAGEMENT_POLICY; | 156 failed_mask |= CHECK_MANAGEMENT_POLICY; |
157 | 157 |
158 // Invoke callback if all checks are complete or there was at least one | 158 // Invoke callback if all checks are complete or there was at least one |
159 // failure and |fail_fast_| is true. | 159 // failure and |fail_fast_| is true. |
160 if (!is_running() || (failed_mask && fail_fast_)) { | 160 if (!is_running() || (failed_mask && fail_fast_)) { |
161 // If we are failing fast, discard any pending results. | 161 // If we are failing fast, discard any pending results. |
162 weak_ptr_factory_.InvalidateWeakPtrs(); | 162 weak_ptr_factory_.InvalidateWeakPtrs(); |
163 running_checks_ = 0; | 163 running_checks_ = 0; |
164 ++current_sequence_number_; | 164 ++current_sequence_number_; |
165 | 165 |
166 callback_.Run(failed_mask); | 166 Callback callback_copy = callback_; |
167 callback_.Reset(); | 167 callback_.Reset(); |
| 168 |
| 169 // This instance may be owned by the callback recipient and deleted here, |
| 170 // so reset |callback_| first and invoke a copy of the callback. |
| 171 callback_copy.Run(failed_mask); |
168 } | 172 } |
169 } | 173 } |
170 | 174 |
171 } // namespace extensions | 175 } // namespace extensions |
OLD | NEW |