| 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 16 matching lines...) Expand all Loading... |
| 27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 28 | 28 |
| 29 ExtensionAppProvider::ExtensionAppProvider( | 29 ExtensionAppProvider::ExtensionAppProvider( |
| 30 AutocompleteProviderListener* listener, | 30 AutocompleteProviderListener* listener, |
| 31 Profile* profile) | 31 Profile* profile) |
| 32 : AutocompleteProvider(listener, profile, | 32 : AutocompleteProvider(listener, profile, |
| 33 AutocompleteProvider::TYPE_EXTENSION_APP) { | 33 AutocompleteProvider::TYPE_EXTENSION_APP) { |
| 34 // Notifications of extensions loading and unloading always come from the | 34 // Notifications of extensions loading and unloading always come from the |
| 35 // non-incognito profile, but we need to see them regardless, as the incognito | 35 // non-incognito profile, but we need to see them regardless, as the incognito |
| 36 // windows can be affected. | 36 // windows can be affected. |
| 37 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 37 registrar_.Add(this, |
| 38 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 38 content::Source<Profile>(profile_->GetOriginalProfile())); | 39 content::Source<Profile>(profile_->GetOriginalProfile())); |
| 39 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 40 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
| 40 content::Source<Profile>(profile_->GetOriginalProfile())); | 41 content::Source<Profile>(profile_->GetOriginalProfile())); |
| 41 RefreshAppList(); | 42 RefreshAppList(); |
| 42 } | 43 } |
| 43 | 44 |
| 44 // static. | 45 // static. |
| 45 void ExtensionAppProvider::LaunchAppFromOmnibox( | 46 void ExtensionAppProvider::LaunchAppFromOmnibox( |
| 46 const AutocompleteMatch& match, | 47 const AutocompleteMatch& match, |
| 47 Profile* profile, | 48 Profile* profile, |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 history::URLRow info; | 218 history::URLRow info; |
| 218 url_db->GetRowForURL(url, &info); | 219 url_db->GetRowForURL(url, &info); |
| 219 type_count_boost = | 220 type_count_boost = |
| 220 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); | 221 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); |
| 221 } | 222 } |
| 222 int relevance = 575 + static_cast<int>(type_count_boost) + | 223 int relevance = 575 + static_cast<int>(type_count_boost) + |
| 223 static_cast<int>(fraction_boost); | 224 static_cast<int>(fraction_boost); |
| 224 DCHECK_LE(relevance, kMaxRelevance); | 225 DCHECK_LE(relevance, kMaxRelevance); |
| 225 return relevance; | 226 return relevance; |
| 226 } | 227 } |
| OLD | NEW |