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

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

Issue 4234004: Fix some UI issues with omnibox extensions in incognito. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 10 years, 1 month 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/autocomplete/keyword_provider.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/autocomplete_popup_model.h" 5 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
6 6
7 #include "unicode/ubidi.h" 7 #include "unicode/ubidi.h"
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/autocomplete/autocomplete_edit.h" 10 #include "chrome/browser/autocomplete/autocomplete_edit.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 TemplateURLModel::CleanUserInputKeyword(match.fill_into_edit)); 214 TemplateURLModel::CleanUserInputKeyword(match.fill_into_edit));
215 if (keyword_hint.empty()) 215 if (keyword_hint.empty())
216 return false; 216 return false;
217 217
218 // Don't provide a hint if this keyword doesn't support replacement. 218 // Don't provide a hint if this keyword doesn't support replacement.
219 const TemplateURL* const template_url = 219 const TemplateURL* const template_url =
220 profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword_hint); 220 profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword_hint);
221 if (!TemplateURL::SupportsReplacement(template_url)) 221 if (!TemplateURL::SupportsReplacement(template_url))
222 return false; 222 return false;
223 223
224 // Don't provide a hint if this is an extension keyword not enabled for
225 // incognito mode (and if this is an incognito profile).
226 if (template_url->IsExtensionKeyword() && profile_->IsOffTheRecord()) {
227 const Extension* extension = profile_->GetExtensionsService()->
228 GetExtensionById(template_url->GetExtensionId(), false);
229 if (!profile_->GetExtensionsService()->IsIncognitoEnabled(extension))
230 return false;
231 }
232
224 keyword->assign(keyword_hint); 233 keyword->assign(keyword_hint);
225 return true; 234 return true;
226 } 235 }
227 236
228 AutocompleteLog* AutocompletePopupModel::GetAutocompleteLog() { 237 AutocompleteLog* AutocompletePopupModel::GetAutocompleteLog() {
229 return new AutocompleteLog(controller_->input().text(), 238 return new AutocompleteLog(controller_->input().text(),
230 controller_->input().type(), selected_line_, 0, controller_->result()); 239 controller_->input().type(), selected_line_, 0, controller_->result());
231 } 240 }
232 241
233 void AutocompletePopupModel::Move(int count) { 242 void AutocompletePopupModel::Move(int count) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 307 }
299 308
300 const SkBitmap* AutocompletePopupModel::GetSpecialIconForMatch( 309 const SkBitmap* AutocompletePopupModel::GetSpecialIconForMatch(
301 const AutocompleteMatch& match) const { 310 const AutocompleteMatch& match) const {
302 if (!match.template_url || !match.template_url->IsExtensionKeyword()) 311 if (!match.template_url || !match.template_url->IsExtensionKeyword())
303 return NULL; 312 return NULL;
304 313
305 return &profile_->GetExtensionsService()->GetOmniboxPopupIcon( 314 return &profile_->GetExtensionsService()->GetOmniboxPopupIcon(
306 match.template_url->GetExtensionId()); 315 match.template_url->GetExtensionId());
307 } 316 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/keyword_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698