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

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

Issue 8733004: Make ExtensionService use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: + Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/automation/automation_provider_observers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 } 92 }
93 93
94 ExtensionAppProvider::~ExtensionAppProvider() { 94 ExtensionAppProvider::~ExtensionAppProvider() {
95 } 95 }
96 96
97 void ExtensionAppProvider::RefreshAppList() { 97 void ExtensionAppProvider::RefreshAppList() {
98 ExtensionService* extension_service = profile_->GetExtensionService(); 98 ExtensionService* extension_service = profile_->GetExtensionService();
99 if (!extension_service) 99 if (!extension_service)
100 return; // During testing, there is no extension service. 100 return; // During testing, there is no extension service.
101 const ExtensionList* extensions = extension_service->extensions(); 101 const ExtensionSet* extensions = extension_service->extensions();
102 extension_apps_.clear(); 102 extension_apps_.clear();
103 for (ExtensionList::const_iterator app = extensions->begin(); 103 for (ExtensionSet::const_iterator app = extensions->begin();
104 app != extensions->end(); ++app) { 104 app != extensions->end(); ++app) {
105 if ((*app)->is_app() && (*app)->GetFullLaunchURL().is_valid()) { 105 if ((*app)->is_app() && (*app)->GetFullLaunchURL().is_valid()) {
106 if (profile_->IsOffTheRecord() && 106 if (profile_->IsOffTheRecord() &&
107 !extension_service->CanLoadInIncognito((*app))) 107 !extension_service->CanLoadInIncognito((*app)))
108 continue; 108 continue;
109 109
110 extension_apps_.push_back( 110 extension_apps_.push_back(
111 std::make_pair(UTF8ToUTF16((*app)->name()), 111 std::make_pair(UTF8ToUTF16((*app)->name()),
112 UTF8ToUTF16((*app)->GetFullLaunchURL().spec()))); 112 UTF8ToUTF16((*app)->GetFullLaunchURL().spec())));
113 } 113 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 history::URLRow info; 159 history::URLRow info;
160 url_db->GetRowForURL(url, &info); 160 url_db->GetRowForURL(url, &info);
161 type_count_boost = 161 type_count_boost =
162 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); 162 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count())));
163 } 163 }
164 int relevance = 575 + static_cast<int>(type_count_boost) + 164 int relevance = 575 + static_cast<int>(type_count_boost) +
165 static_cast<int>(fraction_boost); 165 static_cast<int>(fraction_boost);
166 DCHECK_LE(relevance, kMaxRelevance); 166 DCHECK_LE(relevance, kMaxRelevance);
167 return relevance; 167 return relevance;
168 } 168 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/automation_provider_observers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698