| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/app_list/app_list_syncable_service.h" | 5 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/apps/drive/drive_app_provider.h" | 8 #include "chrome/browser/apps/drive/drive_app_provider.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 owner_->model()->AddObserver(this); | 167 owner_->model()->AddObserver(this); |
| 168 } | 168 } |
| 169 | 169 |
| 170 virtual ~ModelObserver() { | 170 virtual ~ModelObserver() { |
| 171 owner_->model()->RemoveObserver(this); | 171 owner_->model()->RemoveObserver(this); |
| 172 DVLOG(2) << owner_ << ": ModelObserver Removed"; | 172 DVLOG(2) << owner_ << ": ModelObserver Removed"; |
| 173 } | 173 } |
| 174 | 174 |
| 175 private: | 175 private: |
| 176 // AppListModelObserver | 176 // AppListModelObserver |
| 177 virtual void OnAppListItemAdded(AppListItem* item) OVERRIDE { | 177 virtual void OnAppListItemAdded(AppListItem* item) override { |
| 178 DCHECK(!adding_item_); | 178 DCHECK(!adding_item_); |
| 179 adding_item_ = item; // Ignore updates while adding an item. | 179 adding_item_ = item; // Ignore updates while adding an item. |
| 180 VLOG(2) << owner_ << " OnAppListItemAdded: " << item->ToDebugString(); | 180 VLOG(2) << owner_ << " OnAppListItemAdded: " << item->ToDebugString(); |
| 181 owner_->AddOrUpdateFromSyncItem(item); | 181 owner_->AddOrUpdateFromSyncItem(item); |
| 182 adding_item_ = NULL; | 182 adding_item_ = NULL; |
| 183 } | 183 } |
| 184 | 184 |
| 185 virtual void OnAppListItemWillBeDeleted(AppListItem* item) OVERRIDE { | 185 virtual void OnAppListItemWillBeDeleted(AppListItem* item) override { |
| 186 DCHECK(!adding_item_); | 186 DCHECK(!adding_item_); |
| 187 VLOG(2) << owner_ << " OnAppListItemDeleted: " << item->ToDebugString(); | 187 VLOG(2) << owner_ << " OnAppListItemDeleted: " << item->ToDebugString(); |
| 188 // Don't sync folder removal in case the folder still exists on another | 188 // Don't sync folder removal in case the folder still exists on another |
| 189 // device (e.g. with device specific items in it). Empty folders will be | 189 // device (e.g. with device specific items in it). Empty folders will be |
| 190 // deleted when the last item is removed (in PruneEmptySyncFolders()). | 190 // deleted when the last item is removed (in PruneEmptySyncFolders()). |
| 191 if (item->GetItemType() == AppListFolderItem::kItemType) | 191 if (item->GetItemType() == AppListFolderItem::kItemType) |
| 192 return; | 192 return; |
| 193 owner_->RemoveSyncItem(item->id()); | 193 owner_->RemoveSyncItem(item->id()); |
| 194 } | 194 } |
| 195 | 195 |
| 196 virtual void OnAppListItemUpdated(AppListItem* item) OVERRIDE { | 196 virtual void OnAppListItemUpdated(AppListItem* item) override { |
| 197 if (adding_item_) { | 197 if (adding_item_) { |
| 198 // Adding an item may trigger update notifications which should be | 198 // Adding an item may trigger update notifications which should be |
| 199 // ignored. | 199 // ignored. |
| 200 DCHECK_EQ(adding_item_, item); | 200 DCHECK_EQ(adding_item_, item); |
| 201 return; | 201 return; |
| 202 } | 202 } |
| 203 VLOG(2) << owner_ << " OnAppListItemUpdated: " << item->ToDebugString(); | 203 VLOG(2) << owner_ << " OnAppListItemUpdated: " << item->ToDebugString(); |
| 204 owner_->UpdateSyncItem(item); | 204 owner_->UpdateSyncItem(item); |
| 205 } | 205 } |
| 206 | 206 |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 } else { | 935 } else { |
| 936 res += " { " + item_name + " }"; | 936 res += " { " + item_name + " }"; |
| 937 res += " [" + item_ordinal.ToDebugString() + "]"; | 937 res += " [" + item_ordinal.ToDebugString() + "]"; |
| 938 if (!parent_id.empty()) | 938 if (!parent_id.empty()) |
| 939 res += " <" + parent_id.substr(0, 8) + ">"; | 939 res += " <" + parent_id.substr(0, 8) + ">"; |
| 940 } | 940 } |
| 941 return res; | 941 return res; |
| 942 } | 942 } |
| 943 | 943 |
| 944 } // namespace app_list | 944 } // namespace app_list |
| OLD | NEW |