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/background/background_application_list_model.h" | 5 #include "chrome/browser/background/background_application_list_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 ApplicationMap::iterator found = applications_.find(extension->id()); | 219 ApplicationMap::iterator found = applications_.find(extension->id()); |
220 if (found != applications_.end()) { | 220 if (found != applications_.end()) { |
221 delete found->second; | 221 delete found->second; |
222 applications_.erase(found); | 222 applications_.erase(found); |
223 } | 223 } |
224 } | 224 } |
225 | 225 |
226 const Extension* BackgroundApplicationListModel::GetExtension( | 226 const Extension* BackgroundApplicationListModel::GetExtension( |
227 int position) const { | 227 int position) const { |
228 DCHECK(position >= 0 && static_cast<size_t>(position) < extensions_.size()); | 228 DCHECK(position >= 0 && static_cast<size_t>(position) < extensions_.size()); |
229 return extensions_[position]; | 229 return extensions_[position].get(); |
230 } | 230 } |
231 | 231 |
232 const BackgroundApplicationListModel::Application* | 232 const BackgroundApplicationListModel::Application* |
233 BackgroundApplicationListModel::FindApplication( | 233 BackgroundApplicationListModel::FindApplication( |
234 const Extension* extension) const { | 234 const Extension* extension) const { |
235 const std::string& id = extension->id(); | 235 const std::string& id = extension->id(); |
236 ApplicationMap::const_iterator found = applications_.find(id); | 236 ApplicationMap::const_iterator found = applications_.find(id); |
237 return (found == applications_.end()) ? NULL : found->second; | 237 return (found == applications_.end()) ? NULL : found->second; |
238 } | 238 } |
239 | 239 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 (*old_cursor)->name() == (*new_cursor)->name() && | 411 (*old_cursor)->name() == (*new_cursor)->name() && |
412 (*old_cursor)->id() == (*new_cursor)->id()) { | 412 (*old_cursor)->id() == (*new_cursor)->id()) { |
413 ++old_cursor; | 413 ++old_cursor; |
414 ++new_cursor; | 414 ++new_cursor; |
415 } | 415 } |
416 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { | 416 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { |
417 extensions_ = extensions; | 417 extensions_ = extensions; |
418 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); | 418 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); |
419 } | 419 } |
420 } | 420 } |
OLD | NEW |