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/autocomplete/extension_app_provider.h" | 5 #include "chrome/browser/autocomplete/extension_app_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 void ExtensionAppProvider::RefreshAppList() { | 148 void ExtensionAppProvider::RefreshAppList() { |
149 ExtensionService* extension_service = | 149 ExtensionService* extension_service = |
150 extensions::ExtensionSystemFactory::GetForProfile(profile_)-> | 150 extensions::ExtensionSystemFactory::GetForProfile(profile_)-> |
151 extension_service(); | 151 extension_service(); |
152 if (!extension_service) | 152 if (!extension_service) |
153 return; // During testing, there is no extension service. | 153 return; // During testing, there is no extension service. |
154 const ExtensionSet* extensions = extension_service->extensions(); | 154 const ExtensionSet* extensions = extension_service->extensions(); |
155 extension_apps_.clear(); | 155 extension_apps_.clear(); |
156 for (ExtensionSet::const_iterator iter = extensions->begin(); | 156 for (ExtensionSet::const_iterator iter = extensions->begin(); |
157 iter != extensions->end(); ++iter) { | 157 iter != extensions->end(); ++iter) { |
158 const extensions::Extension* app = *iter; | 158 const extensions::Extension* app = iter->get(); |
159 if (!app->ShouldDisplayInAppLauncher()) | 159 if (!app->ShouldDisplayInAppLauncher()) |
160 continue; | 160 continue; |
161 // Note: Apps that appear in the NTP only are not added here since this | 161 // Note: Apps that appear in the NTP only are not added here since this |
162 // provider is currently only used in the app launcher. | 162 // provider is currently only used in the app launcher. |
163 | 163 |
164 if (profile_->IsOffTheRecord() && | 164 if (profile_->IsOffTheRecord() && |
165 !extension_service->CanLoadInIncognito(app)) | 165 !extension_service->CanLoadInIncognito(app)) |
166 continue; | 166 continue; |
167 | 167 |
168 GURL launch_url = app->is_platform_app() ? | 168 GURL launch_url = app->is_platform_app() ? |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 history::URLRow info; | 216 history::URLRow info; |
217 url_db->GetRowForURL(url, &info); | 217 url_db->GetRowForURL(url, &info); |
218 type_count_boost = | 218 type_count_boost = |
219 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); | 219 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); |
220 } | 220 } |
221 int relevance = 575 + static_cast<int>(type_count_boost) + | 221 int relevance = 575 + static_cast<int>(type_count_boost) + |
222 static_cast<int>(fraction_boost); | 222 static_cast<int>(fraction_boost); |
223 DCHECK_LE(relevance, kMaxRelevance); | 223 DCHECK_LE(relevance, kMaxRelevance); |
224 return relevance; | 224 return relevance; |
225 } | 225 } |
OLD | NEW |