| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sync/glue/extension_change_processor.h" | 5 #include "chrome/browser/sync/glue/extension_change_processor.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/extension_sync_data.h" | 12 #include "chrome/browser/extensions/extension_sync_data.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/sync/glue/extension_sync.h" | 14 #include "chrome/browser/sync/glue/extension_sync.h" |
| 15 #include "chrome/browser/sync/glue/extension_util.h" | 15 #include "chrome/browser/sync/glue/extension_util.h" |
| 16 #include "chrome/browser/sync/protocol/extension_specifics.pb.h" | 16 #include "chrome/browser/sync/protocol/extension_specifics.pb.h" |
| 17 #include "chrome/browser/sync/unrecoverable_error_handler.h" | 17 #include "chrome/browser/sync/unrecoverable_error_handler.h" |
| 18 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
| 19 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
| 20 #include "chrome/common/extensions/extension_constants.h" |
| 20 #include "content/browser/browser_thread.h" | 21 #include "content/browser/browser_thread.h" |
| 21 #include "content/common/notification_details.h" | 22 #include "content/common/notification_details.h" |
| 22 #include "content/common/notification_source.h" | 23 #include "content/common/notification_source.h" |
| 23 | 24 |
| 24 namespace browser_sync { | 25 namespace browser_sync { |
| 25 | 26 |
| 26 ExtensionChangeProcessor::ExtensionChangeProcessor( | 27 ExtensionChangeProcessor::ExtensionChangeProcessor( |
| 27 UnrecoverableErrorHandler* error_handler) | 28 UnrecoverableErrorHandler* error_handler) |
| 28 : ChangeProcessor(error_handler), | 29 : ChangeProcessor(error_handler), |
| 29 traits_(GetExtensionSyncTraits()), | 30 traits_(GetExtensionSyncTraits()), |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 if (!traits_.is_valid_and_syncable(extension)) { | 65 if (!traits_.is_valid_and_syncable(extension)) { |
| 65 return; | 66 return; |
| 66 } | 67 } |
| 67 | 68 |
| 68 const std::string& id = extension.id(); | 69 const std::string& id = extension.id(); |
| 69 | 70 |
| 70 // Then handle extension uninstalls. | 71 // Then handle extension uninstalls. |
| 71 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { | 72 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { |
| 72 const UnloadedExtensionInfo& info = | 73 const UnloadedExtensionInfo& info = |
| 73 *Details<UnloadedExtensionInfo>(details).ptr(); | 74 *Details<UnloadedExtensionInfo>(details).ptr(); |
| 74 if (info.reason == UnloadedExtensionInfo::UNINSTALL) { | 75 if (info.reason == extension_misc::UNLOAD_REASON_UNINSTALL) { |
| 75 VLOG(1) << "Removing server data for uninstalled extension " << id | 76 VLOG(1) << "Removing server data for uninstalled extension " << id |
| 76 << " of type " << info.extension->GetType(); | 77 << " of type " << info.extension->GetType(); |
| 77 RemoveServerData(traits_, id, share_handle()); | 78 RemoveServerData(traits_, id, share_handle()); |
| 78 return; | 79 return; |
| 79 } | 80 } |
| 80 } | 81 } |
| 81 | 82 |
| 82 VLOG(1) << "Updating server data for extension " << id | 83 VLOG(1) << "Updating server data for extension " << id |
| 83 << " (notification type = " << type << ")"; | 84 << " (notification type = " << type << ")"; |
| 84 std::string error; | 85 std::string error; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 180 } |
| 180 | 181 |
| 181 void ExtensionChangeProcessor::StopObserving() { | 182 void ExtensionChangeProcessor::StopObserving() { |
| 182 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 183 DCHECK(profile_); | 184 DCHECK(profile_); |
| 184 VLOG(1) << "Unobserving all notifications"; | 185 VLOG(1) << "Unobserving all notifications"; |
| 185 notification_registrar_.RemoveAll(); | 186 notification_registrar_.RemoveAll(); |
| 186 } | 187 } |
| 187 | 188 |
| 188 } // namespace browser_sync | 189 } // namespace browser_sync |
| OLD | NEW |