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 25 matching lines...) Expand all Loading... |
36 using extensions::APIPermission; | 36 using extensions::APIPermission; |
37 using extensions::Extension; | 37 using extensions::Extension; |
38 using extensions::ExtensionList; | 38 using extensions::ExtensionList; |
39 using extensions::PermissionSet; | 39 using extensions::PermissionSet; |
40 using extensions::UnloadedExtensionInfo; | 40 using extensions::UnloadedExtensionInfo; |
41 using extensions::UpdatedExtensionPermissionsInfo; | 41 using extensions::UpdatedExtensionPermissionsInfo; |
42 | 42 |
43 class ExtensionNameComparator { | 43 class ExtensionNameComparator { |
44 public: | 44 public: |
45 explicit ExtensionNameComparator(icu::Collator* collator); | 45 explicit ExtensionNameComparator(icu::Collator* collator); |
46 bool operator()(const Extension* x, const Extension* y); | 46 bool operator()(const scoped_refptr<const Extension>& x, |
| 47 const scoped_refptr<const Extension>& y); |
47 | 48 |
48 private: | 49 private: |
49 icu::Collator* collator_; | 50 icu::Collator* collator_; |
50 }; | 51 }; |
51 | 52 |
52 ExtensionNameComparator::ExtensionNameComparator(icu::Collator* collator) | 53 ExtensionNameComparator::ExtensionNameComparator(icu::Collator* collator) |
53 : collator_(collator) { | 54 : collator_(collator) { |
54 } | 55 } |
55 | 56 |
56 bool ExtensionNameComparator::operator()(const Extension* x, | 57 bool ExtensionNameComparator::operator()( |
57 const Extension* y) { | 58 const scoped_refptr<const Extension>& x, |
| 59 const scoped_refptr<const Extension>& y) { |
58 return l10n_util::StringComparator<string16>(collator_)( | 60 return l10n_util::StringComparator<string16>(collator_)( |
59 UTF8ToUTF16(x->name()), | 61 UTF8ToUTF16(x->name()), UTF8ToUTF16(y->name())); |
60 UTF8ToUTF16(y->name())); | |
61 } | 62 } |
62 | 63 |
63 // Background application representation, private to the | 64 // Background application representation, private to the |
64 // BackgroundApplicationListModel class. | 65 // BackgroundApplicationListModel class. |
65 class BackgroundApplicationListModel::Application | 66 class BackgroundApplicationListModel::Application |
66 : public base::SupportsWeakPtr<Application> { | 67 : public base::SupportsWeakPtr<Application> { |
67 public: | 68 public: |
68 Application(BackgroundApplicationListModel* model, | 69 Application(BackgroundApplicationListModel* model, |
69 const Extension* an_extension); | 70 const Extension* an_extension); |
70 | 71 |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 (*old_cursor)->name() == (*new_cursor)->name() && | 409 (*old_cursor)->name() == (*new_cursor)->name() && |
409 (*old_cursor)->id() == (*new_cursor)->id()) { | 410 (*old_cursor)->id() == (*new_cursor)->id()) { |
410 ++old_cursor; | 411 ++old_cursor; |
411 ++new_cursor; | 412 ++new_cursor; |
412 } | 413 } |
413 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { | 414 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { |
414 extensions_ = extensions; | 415 extensions_ = extensions; |
415 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); | 416 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); |
416 } | 417 } |
417 } | 418 } |
OLD | NEW |