| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 void ExtensionAppProvider::RefreshAppList() { | 89 void ExtensionAppProvider::RefreshAppList() { |
| 90 ExtensionService* extension_service = profile_->GetExtensionService(); | 90 ExtensionService* extension_service = profile_->GetExtensionService(); |
| 91 if (!extension_service) | 91 if (!extension_service) |
| 92 return; // During testing, there is no extension service. | 92 return; // During testing, there is no extension service. |
| 93 const ExtensionList* extensions = extension_service->extensions(); | 93 const ExtensionList* extensions = extension_service->extensions(); |
| 94 extension_apps_.clear(); | 94 extension_apps_.clear(); |
| 95 for (ExtensionList::const_iterator app = extensions->begin(); | 95 for (ExtensionList::const_iterator app = extensions->begin(); |
| 96 app != extensions->end(); ++app) { | 96 app != extensions->end(); ++app) { |
| 97 if ((*app)->is_app() && (*app)->GetFullLaunchURL().is_valid()) { | 97 if ((*app)->is_app() && (*app)->GetFullLaunchURL().is_valid()) { |
| 98 if (profile_->IsOffTheRecord() && |
| 99 !extension_service->CanLoadInIncognito((*app))) |
| 100 continue; |
| 101 |
| 98 extension_apps_.push_back( | 102 extension_apps_.push_back( |
| 99 std::make_pair((*app)->name(), | 103 std::make_pair((*app)->name(), |
| 100 (*app)->GetFullLaunchURL().spec())); | 104 (*app)->GetFullLaunchURL().spec())); |
| 101 } | 105 } |
| 102 } | 106 } |
| 103 } | 107 } |
| 104 | 108 |
| 105 void ExtensionAppProvider::RegisterForNotifications() { | 109 void ExtensionAppProvider::RegisterForNotifications() { |
| 106 registrar_.Add(this, NotificationType::EXTENSION_LOADED, | 110 registrar_.Add(this, NotificationType::EXTENSION_LOADED, |
| 107 NotificationService::AllSources()); | 111 NotificationService::AllSources()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 history::URLRow info; | 168 history::URLRow info; |
| 165 url_db->GetRowForURL(url, &info); | 169 url_db->GetRowForURL(url, &info); |
| 166 type_count_boost = | 170 type_count_boost = |
| 167 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); | 171 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); |
| 168 } | 172 } |
| 169 int relevance = 575 + static_cast<int>(type_count_boost) + | 173 int relevance = 575 + static_cast<int>(type_count_boost) + |
| 170 static_cast<int>(fraction_boost); | 174 static_cast<int>(fraction_boost); |
| 171 DCHECK_LE(relevance, kMaxRelevance); | 175 DCHECK_LE(relevance, kMaxRelevance); |
| 172 return relevance; | 176 return relevance; |
| 173 } | 177 } |
| OLD | NEW |