OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <list> | 5 #include <list> |
6 #include <map> | 6 #include <map> |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 ON_CALL(*this, GetExtensionExistingVersion(_, _)) | 178 ON_CALL(*this, GetExtensionExistingVersion(_, _)) |
179 .WillByDefault(Invoke(delegate, | 179 .WillByDefault(Invoke(delegate, |
180 &ExtensionDownloaderDelegate::GetExtensionExistingVersion)); | 180 &ExtensionDownloaderDelegate::GetExtensionExistingVersion)); |
181 } | 181 } |
182 | 182 |
183 private: | 183 private: |
184 base::Closure quit_closure_; | 184 base::Closure quit_closure_; |
185 }; | 185 }; |
186 | 186 |
187 const int kNotificationsObserved[] = { | 187 const int kNotificationsObserved[] = { |
188 chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED, | 188 extensions::NOTIFICATION_EXTENSION_UPDATING_STARTED, |
189 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, | 189 extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND, |
190 }; | 190 }; |
191 | 191 |
192 // A class that observes the notifications sent by the ExtensionUpdater and | 192 // A class that observes the notifications sent by the ExtensionUpdater and |
193 // the ExtensionDownloader. | 193 // the ExtensionDownloader. |
194 class NotificationsObserver : public content::NotificationObserver { | 194 class NotificationsObserver : public content::NotificationObserver { |
195 public: | 195 public: |
196 NotificationsObserver() { | 196 NotificationsObserver() { |
197 for (size_t i = 0; i < arraysize(kNotificationsObserved); ++i) { | 197 for (size_t i = 0; i < arraysize(kNotificationsObserved); ++i) { |
198 count_[i] = 0; | 198 count_[i] = 0; |
199 registrar_.Add(this, | 199 registrar_.Add(this, |
(...skipping 27 matching lines...) Expand all Loading... |
227 | 227 |
228 private: | 228 private: |
229 virtual void Observe(int type, | 229 virtual void Observe(int type, |
230 const content::NotificationSource& source, | 230 const content::NotificationSource& source, |
231 const content::NotificationDetails& details) OVERRIDE { | 231 const content::NotificationDetails& details) OVERRIDE { |
232 if (!quit_closure_.is_null()) | 232 if (!quit_closure_.is_null()) |
233 quit_closure_.Run(); | 233 quit_closure_.Run(); |
234 for (size_t i = 0; i < arraysize(kNotificationsObserved); ++i) { | 234 for (size_t i = 0; i < arraysize(kNotificationsObserved); ++i) { |
235 if (kNotificationsObserved[i] == type) { | 235 if (kNotificationsObserved[i] == type) { |
236 count_[i]++; | 236 count_[i]++; |
237 if (type == chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND) { | 237 if (type == extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND) { |
238 updated_.insert( | 238 updated_.insert( |
239 content::Details<UpdateDetails>(details)->id); | 239 content::Details<UpdateDetails>(details)->id); |
240 } | 240 } |
241 return; | 241 return; |
242 } | 242 } |
243 } | 243 } |
244 NOTREACHED(); | 244 NOTREACHED(); |
245 } | 245 } |
246 | 246 |
247 content::NotificationRegistrar registrar_; | 247 content::NotificationRegistrar registrar_; |
(...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1867 // -prodversionmin (shouldn't update if browser version too old) | 1867 // -prodversionmin (shouldn't update if browser version too old) |
1868 // -manifests & updates arriving out of order / interleaved | 1868 // -manifests & updates arriving out of order / interleaved |
1869 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 1869 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
1870 // -An extension gets uninstalled while updates are in progress (so it doesn't | 1870 // -An extension gets uninstalled while updates are in progress (so it doesn't |
1871 // "come back from the dead") | 1871 // "come back from the dead") |
1872 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 1872 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
1873 // you don't get downgraded accidentally) | 1873 // you don't get downgraded accidentally) |
1874 // -An update manifest mentions multiple updates | 1874 // -An update manifest mentions multiple updates |
1875 | 1875 |
1876 } // namespace extensions | 1876 } // namespace extensions |
OLD | NEW |