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/string16.h" | 10 #include "base/string16.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 AppLauncherHandler::RecordAppLaunchType( | 55 AppLauncherHandler::RecordAppLaunchType( |
56 extension_misc::APP_LAUNCH_OMNIBOX_APP); | 56 extension_misc::APP_LAUNCH_OMNIBOX_APP); |
57 | 57 |
58 // Look at the preferences to find the right launch container. If no | 58 // Look at the preferences to find the right launch container. If no |
59 // preference is set, launch as a regular tab. | 59 // preference is set, launch as a regular tab. |
60 extension_misc::LaunchContainer launch_container = | 60 extension_misc::LaunchContainer launch_container = |
61 service->extension_prefs()->GetLaunchContainer( | 61 service->extension_prefs()->GetLaunchContainer( |
62 extension, extensions::ExtensionPrefs::LAUNCH_REGULAR); | 62 extension, extensions::ExtensionPrefs::LAUNCH_REGULAR); |
63 | 63 |
64 application_launch::OpenApplication(profile, extension, launch_container, | 64 application_launch::OpenApplication(application_launch::LaunchParams( |
65 GURL(), disposition, NULL); | 65 profile, extension, launch_container, disposition)); |
66 } | 66 } |
67 | 67 |
68 void ExtensionAppProvider::AddExtensionAppForTesting( | 68 void ExtensionAppProvider::AddExtensionAppForTesting( |
69 const ExtensionApp& extension_app) { | 69 const ExtensionApp& extension_app) { |
70 extension_apps_.push_back(extension_app); | 70 extension_apps_.push_back(extension_app); |
71 } | 71 } |
72 | 72 |
73 AutocompleteMatch ExtensionAppProvider::CreateAutocompleteMatch( | 73 AutocompleteMatch ExtensionAppProvider::CreateAutocompleteMatch( |
74 const AutocompleteInput& input, | 74 const AutocompleteInput& input, |
75 const ExtensionApp& app, | 75 const ExtensionApp& app, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 history::URLRow info; | 217 history::URLRow info; |
218 url_db->GetRowForURL(url, &info); | 218 url_db->GetRowForURL(url, &info); |
219 type_count_boost = | 219 type_count_boost = |
220 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); | 220 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); |
221 } | 221 } |
222 int relevance = 575 + static_cast<int>(type_count_boost) + | 222 int relevance = 575 + static_cast<int>(type_count_boost) + |
223 static_cast<int>(fraction_boost); | 223 static_cast<int>(fraction_boost); |
224 DCHECK_LE(relevance, kMaxRelevance); | 224 DCHECK_LE(relevance, kMaxRelevance); |
225 return relevance; | 225 return relevance; |
226 } | 226 } |
OLD | NEW |