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