| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 if (matches_name || matches_url) { | 140 if (matches_name || matches_url) { |
| 141 // We have a match, might be a partial match. | 141 // We have a match, might be a partial match. |
| 142 matches_.push_back(CreateAutocompleteMatch( | 142 matches_.push_back(CreateAutocompleteMatch( |
| 143 input, *app, name_match_index, url_match_index)); | 143 input, *app, name_match_index, url_match_index)); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 ExtensionAppProvider::~ExtensionAppProvider() { | 148 ExtensionAppProvider::~ExtensionAppProvider() { |
| 149 LOG(ERROR) << "*#*#*# ~ExtensionAppProvider this = " << this; |
| 149 } | 150 } |
| 150 | 151 |
| 151 void ExtensionAppProvider::RefreshAppList() { | 152 void ExtensionAppProvider::RefreshAppList() { |
| 153 LOG(ERROR) << "<>$<>$ RefreshAppList this = " << this; |
| 152 ExtensionService* extension_service = | 154 ExtensionService* extension_service = |
| 153 extensions::ExtensionSystemFactory::GetForProfile(profile_)-> | 155 extensions::ExtensionSystemFactory::GetForProfile(profile_)-> |
| 154 extension_service(); | 156 extension_service(); |
| 155 if (!extension_service) | 157 if (!extension_service) |
| 156 return; // During testing, there is no extension service. | 158 return; // During testing, there is no extension service. |
| 157 const ExtensionSet* extensions = extension_service->extensions(); | 159 const ExtensionSet* extensions = extension_service->extensions(); |
| 158 extension_apps_.clear(); | 160 extension_apps_.clear(); |
| 159 for (ExtensionSet::const_iterator iter = extensions->begin(); | 161 for (ExtensionSet::const_iterator iter = extensions->begin(); |
| 160 iter != extensions->end(); ++iter) { | 162 iter != extensions->end(); ++iter) { |
| 161 const extensions::Extension* app = *iter; | 163 const extensions::Extension* app = *iter; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 history::URLRow info; | 219 history::URLRow info; |
| 218 url_db->GetRowForURL(url, &info); | 220 url_db->GetRowForURL(url, &info); |
| 219 type_count_boost = | 221 type_count_boost = |
| 220 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); | 222 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); |
| 221 } | 223 } |
| 222 int relevance = 575 + static_cast<int>(type_count_boost) + | 224 int relevance = 575 + static_cast<int>(type_count_boost) + |
| 223 static_cast<int>(fraction_boost); | 225 static_cast<int>(fraction_boost); |
| 224 DCHECK_LE(relevance, kMaxRelevance); | 226 DCHECK_LE(relevance, kMaxRelevance); |
| 225 return relevance; | 227 return relevance; |
| 226 } | 228 } |
| OLD | NEW |