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