| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 if (profile_->IsOffTheRecord() && | 167 if (profile_->IsOffTheRecord() && |
| 168 !extension_util::CanLoadInIncognito(app, extension_service)) | 168 !extension_util::CanLoadInIncognito(app, extension_service)) |
| 169 continue; | 169 continue; |
| 170 | 170 |
| 171 GURL launch_url = app->is_platform_app() ? | 171 GURL launch_url = app->is_platform_app() ? |
| 172 app->url() : extensions::AppLaunchInfo::GetFullLaunchURL(app); | 172 app->url() : extensions::AppLaunchInfo::GetFullLaunchURL(app); |
| 173 DCHECK(launch_url.is_valid()); | 173 DCHECK(launch_url.is_valid()); |
| 174 | 174 |
| 175 ExtensionApp extension_app = { | 175 ExtensionApp extension_app = { |
| 176 UTF8ToUTF16(app->name()), | 176 base::UTF8ToUTF16(app->name()), |
| 177 UTF8ToUTF16(launch_url.spec()), | 177 base::UTF8ToUTF16(launch_url.spec()), |
| 178 // Only hosted apps have recognizable URLs that users might type in, | 178 // Only hosted apps have recognizable URLs that users might type in, |
| 179 // packaged apps and hosted apps use chrome-extension:// URLs that are | 179 // packaged apps and hosted apps use chrome-extension:// URLs that are |
| 180 // normally not shown to users. | 180 // normally not shown to users. |
| 181 app->is_hosted_app() | 181 app->is_hosted_app() |
| 182 }; | 182 }; |
| 183 extension_apps_.push_back(extension_app); | 183 extension_apps_.push_back(extension_app); |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 | 186 |
| 187 void ExtensionAppProvider::Observe(int type, | 187 void ExtensionAppProvider::Observe(int type, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 history::URLRow info; | 219 history::URLRow info; |
| 220 url_db->GetRowForURL(url, &info); | 220 url_db->GetRowForURL(url, &info); |
| 221 type_count_boost = | 221 type_count_boost = |
| 222 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()))); |
| 223 } | 223 } |
| 224 int relevance = 575 + static_cast<int>(type_count_boost) + | 224 int relevance = 575 + static_cast<int>(type_count_boost) + |
| 225 static_cast<int>(fraction_boost); | 225 static_cast<int>(fraction_boost); |
| 226 DCHECK_LE(relevance, kMaxRelevance); | 226 DCHECK_LE(relevance, kMaxRelevance); |
| 227 return relevance; | 227 return relevance; |
| 228 } | 228 } |
| OLD | NEW |