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

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

Issue 7016005: Don't show suggestions in the Omnibox from the Extension App provider unless the app has Incognit... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months 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 | no next file » | 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Incognito extensions must have incognito enabled and split mode set
Matt Perry 2011/05/11 23:55:27 I think we might want to apply this to packaged ap
99 // to show up in the omnibox as a suggestion.
100 if (profile_->IsOffTheRecord() &&
101 (!profile_->GetExtensionService()->
102 IsIncognitoEnabled((*app)->id()) ||
103 !(*app)->incognito_split_mode()))
104 continue;
105
98 extension_apps_.push_back( 106 extension_apps_.push_back(
99 std::make_pair((*app)->name(), 107 std::make_pair((*app)->name(),
100 (*app)->GetFullLaunchURL().spec())); 108 (*app)->GetFullLaunchURL().spec()));
101 } 109 }
102 } 110 }
103 } 111 }
104 112
105 void ExtensionAppProvider::RegisterForNotifications() { 113 void ExtensionAppProvider::RegisterForNotifications() {
106 registrar_.Add(this, NotificationType::EXTENSION_LOADED, 114 registrar_.Add(this, NotificationType::EXTENSION_LOADED,
107 NotificationService::AllSources()); 115 NotificationService::AllSources());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 history::URLRow info; 172 history::URLRow info;
165 url_db->GetRowForURL(url, &info); 173 url_db->GetRowForURL(url, &info);
166 type_count_boost = 174 type_count_boost =
167 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); 175 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count())));
168 } 176 }
169 int relevance = 575 + static_cast<int>(type_count_boost) + 177 int relevance = 575 + static_cast<int>(type_count_boost) +
170 static_cast<int>(fraction_boost); 178 static_cast<int>(fraction_boost);
171 DCHECK_LE(relevance, kMaxRelevance); 179 DCHECK_LE(relevance, kMaxRelevance);
172 return relevance; 180 return relevance;
173 } 181 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698