| 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" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/extensions/extension_system_factory.h" | 14 #include "chrome/browser/extensions/extension_system_factory.h" |
| 14 #include "chrome/browser/history/history_service.h" | 15 #include "chrome/browser/history/history_service.h" |
| 15 #include "chrome/browser/history/history_service_factory.h" | 16 #include "chrome/browser/history/history_service_factory.h" |
| 16 #include "chrome/browser/history/url_database.h" | 17 #include "chrome/browser/history/url_database.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/extensions/application_launch.h" | 19 #include "chrome/browser/ui/extensions/application_launch.h" |
| 19 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 20 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 20 #include "chrome/common/chrome_notification_types.h" | |
| 21 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
| 22 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 22 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| 23 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 25 | 25 |
| 26 ExtensionAppProvider::ExtensionAppProvider( | 26 ExtensionAppProvider::ExtensionAppProvider( |
| 27 AutocompleteProviderListener* listener, | 27 AutocompleteProviderListener* listener, |
| 28 Profile* profile) | 28 Profile* profile) |
| 29 : AutocompleteProvider(listener, profile, | 29 : AutocompleteProvider(listener, profile, |
| 30 AutocompleteProvider::TYPE_EXTENSION_APP) { | 30 AutocompleteProvider::TYPE_EXTENSION_APP) { |
| (...skipping 185 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 |