| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string16.h" | 10 #include "base/string16.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/history/history.h" | 13 #include "chrome/browser/history/history.h" |
| 14 #include "chrome/browser/history/url_database.h" | 14 #include "chrome/browser/history/url_database.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "content/common/notification_service.h" | 17 #include "content/public/browser/notification_source.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 19 | 19 |
| 20 ExtensionAppProvider::ExtensionAppProvider(ACProviderListener* listener, | 20 ExtensionAppProvider::ExtensionAppProvider(ACProviderListener* listener, |
| 21 Profile* profile) | 21 Profile* profile) |
| 22 : AutocompleteProvider(listener, profile, "ExtensionApps") { | 22 : AutocompleteProvider(listener, profile, "ExtensionApps") { |
| 23 RegisterForNotifications(); | 23 RegisterForNotifications(); |
| 24 RefreshAppList(); | 24 RefreshAppList(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void ExtensionAppProvider::AddExtensionAppForTesting(const string16& app_name, | 27 void ExtensionAppProvider::AddExtensionAppForTesting(const string16& app_name, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 history::URLRow info; | 145 history::URLRow info; |
| 146 url_db->GetRowForURL(url, &info); | 146 url_db->GetRowForURL(url, &info); |
| 147 type_count_boost = | 147 type_count_boost = |
| 148 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); | 148 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); |
| 149 } | 149 } |
| 150 int relevance = 575 + static_cast<int>(type_count_boost) + | 150 int relevance = 575 + static_cast<int>(type_count_boost) + |
| 151 static_cast<int>(fraction_boost); | 151 static_cast<int>(fraction_boost); |
| 152 DCHECK_LE(relevance, kMaxRelevance); | 152 DCHECK_LE(relevance, kMaxRelevance); |
| 153 return relevance; | 153 return relevance; |
| 154 } | 154 } |
| OLD | NEW |