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/recommended_apps.h" | 5 #include "chrome/browser/ui/app_list/recommended_apps.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 void RecommendedApps::Update() { | 63 void RecommendedApps::Update() { |
64 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); | 64 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); |
65 | 65 |
66 std::vector<AppSortInfo> sorted_apps; | 66 std::vector<AppSortInfo> sorted_apps; |
67 const extensions::ExtensionSet& extensions = | 67 const extensions::ExtensionSet& extensions = |
68 extensions::ExtensionRegistry::Get(profile_)->enabled_extensions(); | 68 extensions::ExtensionRegistry::Get(profile_)->enabled_extensions(); |
69 for (extensions::ExtensionSet::const_iterator app = extensions.begin(); | 69 for (extensions::ExtensionSet::const_iterator app = extensions.begin(); |
70 app != extensions.end(); | 70 app != extensions.end(); |
71 ++app) { | 71 ++app) { |
72 if (!extensions::ui_util::ShouldDisplayInAppLauncher(*app, profile_)) | 72 if (!extensions::ui_util::ShouldDisplayInAppLauncher(app->get(), profile_)) |
73 continue; | 73 continue; |
74 | 74 |
75 sorted_apps.push_back( | 75 sorted_apps.push_back( |
76 AppSortInfo(app->get(), prefs->GetLastLaunchTime((*app)->id()))); | 76 AppSortInfo(app->get(), prefs->GetLastLaunchTime((*app)->id()))); |
77 } | 77 } |
78 | 78 |
79 std::sort(sorted_apps.begin(), sorted_apps.end(), &AppLaunchedMoreRecent); | 79 std::sort(sorted_apps.begin(), sorted_apps.end(), &AppLaunchedMoreRecent); |
80 | 80 |
81 const size_t kMaxRecommendedApps = 4; | 81 const size_t kMaxRecommendedApps = 4; |
82 sorted_apps.resize(std::min(kMaxRecommendedApps, sorted_apps.size())); | 82 sorted_apps.resize(std::min(kMaxRecommendedApps, sorted_apps.size())); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 | 118 |
119 void RecommendedApps::OnExtensionUninstalled( | 119 void RecommendedApps::OnExtensionUninstalled( |
120 content::BrowserContext* browser_context, | 120 content::BrowserContext* browser_context, |
121 const extensions::Extension* extension, | 121 const extensions::Extension* extension, |
122 extensions::UninstallReason reason) { | 122 extensions::UninstallReason reason) { |
123 Update(); | 123 Update(); |
124 } | 124 } |
125 | 125 |
126 } // namespace app_list | 126 } // namespace app_list |
OLD | NEW |