Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Side by Side Diff: chrome/browser/autocomplete/extension_app_provider.cc

Issue 102103005: Move c/c/e/extension_set to top-level extensions/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Move ExtensionSet to extensions namespace Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 ExtensionAppProvider::~ExtensionAppProvider() { 147 ExtensionAppProvider::~ExtensionAppProvider() {
148 } 148 }
149 149
150 void ExtensionAppProvider::RefreshAppList() { 150 void ExtensionAppProvider::RefreshAppList() {
151 ExtensionService* extension_service = 151 ExtensionService* extension_service =
152 extensions::ExtensionSystemFactory::GetForProfile(profile_)-> 152 extensions::ExtensionSystemFactory::GetForProfile(profile_)->
153 extension_service(); 153 extension_service();
154 if (!extension_service) 154 if (!extension_service)
155 return; // During testing, there is no extension service. 155 return; // During testing, there is no extension service.
156 const ExtensionSet* extensions = extension_service->extensions(); 156 const extensions::ExtensionSet* extensions = extension_service->extensions();
157 extension_apps_.clear(); 157 extension_apps_.clear();
158 for (ExtensionSet::const_iterator iter = extensions->begin(); 158 for (extensions::ExtensionSet::const_iterator iter = extensions->begin();
159 iter != extensions->end(); ++iter) { 159 iter != extensions->end(); ++iter) {
160 const extensions::Extension* app = iter->get(); 160 const extensions::Extension* app = iter->get();
161 if (!app->ShouldDisplayInAppLauncher()) 161 if (!app->ShouldDisplayInAppLauncher())
162 continue; 162 continue;
163 // Note: Apps that appear in the NTP only are not added here since this 163 // Note: Apps that appear in the NTP only are not added here since this
164 // provider is currently only used in the app launcher. 164 // provider is currently only used in the app launcher.
165 165
166 if (profile_->IsOffTheRecord() && 166 if (profile_->IsOffTheRecord() &&
167 !extension_util::CanLoadInIncognito(app, extension_service)) 167 !extension_util::CanLoadInIncognito(app, extension_service))
168 continue; 168 continue;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 history::URLRow info; 218 history::URLRow info;
219 url_db->GetRowForURL(url, &info); 219 url_db->GetRowForURL(url, &info);
220 type_count_boost = 220 type_count_boost =
221 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); 221 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count())));
222 } 222 }
223 int relevance = 575 + static_cast<int>(type_count_boost) + 223 int relevance = 575 + static_cast<int>(type_count_boost) +
224 static_cast<int>(fraction_boost); 224 static_cast<int>(fraction_boost);
225 DCHECK_LE(relevance, kMaxRelevance); 225 DCHECK_LE(relevance, kMaxRelevance);
226 return relevance; 226 return relevance;
227 } 227 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698