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 "chrome/browser/policy/app_pack_updater.h" | 5 #include "chrome/browser/policy/app_pack_updater.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/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 271 |
272 if (EndsWith(basename, kCRXFileExtension, false /* case-sensitive */)) { | 272 if (EndsWith(basename, kCRXFileExtension, false /* case-sensitive */)) { |
273 size_t n = basename.find('-'); | 273 size_t n = basename.find('-'); |
274 if (n != std::string::npos && n + 1 < basename.size() - 4) { | 274 if (n != std::string::npos && n + 1 < basename.size() - 4) { |
275 id = basename.substr(0, n); | 275 id = basename.substr(0, n); |
276 // Size of |version| = total size - "<id>" - "-" - ".crx" | 276 // Size of |version| = total size - "<id>" - "-" - ".crx" |
277 version = basename.substr(n + 1, basename.size() - 5 - id.size()); | 277 version = basename.substr(n + 1, basename.size() - 5 - id.size()); |
278 } | 278 } |
279 } | 279 } |
280 | 280 |
281 if (!Extension::IdIsValid(id)) { | 281 if (!extensions::Extension::IdIsValid(id)) { |
282 LOG(ERROR) << "Bad AppPack extension id in cache: " << id; | 282 LOG(ERROR) << "Bad AppPack extension id in cache: " << id; |
283 id.clear(); | 283 id.clear(); |
284 } else if (!ContainsKey(*valid_ids, id)) { | 284 } else if (!ContainsKey(*valid_ids, id)) { |
285 LOG(WARNING) << basename << " is in the cache but is not configured by " | 285 LOG(WARNING) << basename << " is in the cache but is not configured by " |
286 << "the AppPack policy, and will be erased."; | 286 << "the AppPack policy, and will be erased."; |
287 id.clear(); | 287 id.clear(); |
288 } | 288 } |
289 | 289 |
290 if (!Version(version).IsValid()) { | 290 if (!Version(version).IsValid()) { |
291 LOG(ERROR) << "Bad AppPack extension version in cache: " << version; | 291 LOG(ERROR) << "Bad AppPack extension version in cache: " << version; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 void AppPackUpdater::SetScreenSaverPath(const FilePath& path) { | 540 void AppPackUpdater::SetScreenSaverPath(const FilePath& path) { |
541 // Don't invoke the callback if the path isn't changing. | 541 // Don't invoke the callback if the path isn't changing. |
542 if (path != screen_saver_path_) { | 542 if (path != screen_saver_path_) { |
543 screen_saver_path_ = path; | 543 screen_saver_path_ = path; |
544 if (!screen_saver_update_callback_.is_null()) | 544 if (!screen_saver_update_callback_.is_null()) |
545 screen_saver_update_callback_.Run(screen_saver_path_); | 545 screen_saver_update_callback_.Run(screen_saver_path_); |
546 } | 546 } |
547 } | 547 } |
548 | 548 |
549 } // namespace policy | 549 } // namespace policy |
OLD | NEW |