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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 const content::NotificationSource& source, | 155 const content::NotificationSource& source, |
156 const content::NotificationDetails& details) { | 156 const content::NotificationDetails& details) { |
157 switch (type) { | 157 switch (type) { |
158 case chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED: | 158 case chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED: |
159 DCHECK_EQ(chromeos::kAppPack, | 159 DCHECK_EQ(chromeos::kAppPack, |
160 *content::Details<const std::string>(details).ptr()); | 160 *content::Details<const std::string>(details).ptr()); |
161 LoadPolicy(); | 161 LoadPolicy(); |
162 break; | 162 break; |
163 | 163 |
164 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: | 164 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: |
165 OnCrxInstallFailed(content::Source<CrxInstaller>(source).ptr()); | 165 OnCrxInstallFailed( |
| 166 content::Source<extensions::CrxInstaller>(source).ptr()); |
166 break; | 167 break; |
167 | 168 |
168 default: | 169 default: |
169 NOTREACHED(); | 170 NOTREACHED(); |
170 } | 171 } |
171 } | 172 } |
172 | 173 |
173 void AppPackUpdater::OnIPAddressChanged() { | 174 void AppPackUpdater::OnIPAddressChanged() { |
174 // Check if the AppPack has been fully downloaded whenever the network | 175 // Check if the AppPack has been fully downloaded whenever the network |
175 // changes. This allows the AppPack to recover in case the network wasn't | 176 // changes. This allows the AppPack to recover in case the network wasn't |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 entry.cached_version = version; | 540 entry.cached_version = version; |
540 | 541 |
541 if (id == screen_saver_id_) { | 542 if (id == screen_saver_id_) { |
542 VLOG(1) << "AppPack got the screen saver extension at " << path; | 543 VLOG(1) << "AppPack got the screen saver extension at " << path; |
543 SetScreenSaverPath(FilePath(path)); | 544 SetScreenSaverPath(FilePath(path)); |
544 } else { | 545 } else { |
545 UpdateExtensionLoader(); | 546 UpdateExtensionLoader(); |
546 } | 547 } |
547 } | 548 } |
548 | 549 |
549 void AppPackUpdater::OnCrxInstallFailed(CrxInstaller* installer) { | 550 void AppPackUpdater::OnCrxInstallFailed(extensions::CrxInstaller* installer) { |
550 FilePath path = installer->source_file(); | 551 FilePath path = installer->source_file(); |
551 | 552 |
552 // Search for |path| in |cached_extensions_|, and delete it if found. | 553 // Search for |path| in |cached_extensions_|, and delete it if found. |
553 for (CacheEntryMap::iterator it = cached_extensions_.begin(); | 554 for (CacheEntryMap::iterator it = cached_extensions_.begin(); |
554 it != cached_extensions_.end(); ++it) { | 555 it != cached_extensions_.end(); ++it) { |
555 if (it->second.path == path.value()) { | 556 if (it->second.path == path.value()) { |
556 LOG(ERROR) << "AppPack extension at " << path.value() << " failed to " | 557 LOG(ERROR) << "AppPack extension at " << path.value() << " failed to " |
557 << "install, deleting it."; | 558 << "install, deleting it."; |
558 cached_extensions_.erase(it); | 559 cached_extensions_.erase(it); |
559 UpdateExtensionLoader(); | 560 UpdateExtensionLoader(); |
(...skipping 26 matching lines...) Expand all Loading... |
586 } | 587 } |
587 } | 588 } |
588 | 589 |
589 void AppPackUpdater::SetUpdateChecked(const std::string& id) { | 590 void AppPackUpdater::SetUpdateChecked(const std::string& id) { |
590 PolicyEntryMap::iterator entry = app_pack_extensions_.find(id); | 591 PolicyEntryMap::iterator entry = app_pack_extensions_.find(id); |
591 if (entry != app_pack_extensions_.end()) | 592 if (entry != app_pack_extensions_.end()) |
592 entry->second.update_checked = true; | 593 entry->second.update_checked = true; |
593 } | 594 } |
594 | 595 |
595 } // namespace policy | 596 } // namespace policy |
OLD | NEW |