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

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

Issue 3417011: Makes match preview send the dimensions of the omnibox to the page. (Closed)
Patch Set: Fix unittest Created 10 years, 3 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
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"
11 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" 11 #include "chrome/browser/autocomplete/autocomplete_popup_view.h"
12 #include "chrome/browser/profile.h" 12 #include "chrome/browser/profile.h"
13 #include "chrome/browser/extensions/extensions_service.h" 13 #include "chrome/browser/extensions/extensions_service.h"
14 #include "chrome/browser/search_engines/template_url.h" 14 #include "chrome/browser/search_engines/template_url.h"
15 #include "chrome/browser/search_engines/template_url_model.h" 15 #include "chrome/browser/search_engines/template_url_model.h"
16 #include "chrome/common/notification_service.h" 16 #include "chrome/common/notification_service.h"
17 #include "gfx/rect.h"
17 18
18 /////////////////////////////////////////////////////////////////////////////// 19 ///////////////////////////////////////////////////////////////////////////////
19 // AutocompletePopupModel 20 // AutocompletePopupModel
20 21
21 AutocompletePopupModel::AutocompletePopupModel( 22 AutocompletePopupModel::AutocompletePopupModel(
22 AutocompletePopupView* popup_view, 23 AutocompletePopupView* popup_view,
23 AutocompleteEditModel* edit_model, 24 AutocompleteEditModel* edit_model,
24 Profile* profile) 25 Profile* profile)
25 : view_(popup_view), 26 : view_(popup_view),
26 edit_model_(edit_model), 27 edit_model_(edit_model),
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 kNoMatch : static_cast<size_t>(result->default_match() - result->begin()); 285 kNoMatch : static_cast<size_t>(result->default_match() - result->begin());
285 // There had better not be a nonempty result set with no default match. 286 // There had better not be a nonempty result set with no default match.
286 CHECK((selected_line_ != kNoMatch) || result->empty()); 287 CHECK((selected_line_ != kNoMatch) || result->empty());
287 // If we're going to trim the window size to no longer include the hovered 288 // If we're going to trim the window size to no longer include the hovered
288 // line, turn hover off. Practically, this shouldn't happen, but it 289 // line, turn hover off. Practically, this shouldn't happen, but it
289 // doesn't hurt to be defensive. 290 // doesn't hurt to be defensive.
290 if ((hovered_line_ != kNoMatch) && (result->size() <= hovered_line_)) 291 if ((hovered_line_ != kNoMatch) && (result->size() <= hovered_line_))
291 SetHoveredLine(kNoMatch); 292 SetHoveredLine(kNoMatch);
292 293
293 view_->UpdatePopupAppearance(); 294 view_->UpdatePopupAppearance();
295
296 #if defined(TOOLKIT_VIEWS)
297 edit_model_->PopupBoundsChangedTo(view_->GetTargetBounds());
298 #else
299 // TODO: port
300 #endif
294 } 301 }
295 302
296 const SkBitmap* AutocompletePopupModel::GetSpecialIconForMatch( 303 const SkBitmap* AutocompletePopupModel::GetSpecialIconForMatch(
297 const AutocompleteMatch& match) const { 304 const AutocompleteMatch& match) const {
298 if (!match.template_url || !match.template_url->IsExtensionKeyword()) 305 if (!match.template_url || !match.template_url->IsExtensionKeyword())
299 return NULL; 306 return NULL;
300 307
301 return &profile_->GetExtensionsService()->GetOmniboxPopupIcon( 308 return &profile_->GetExtensionsService()->GetOmniboxPopupIcon(
302 match.template_url->GetExtensionId()); 309 match.template_url->GetExtensionId());
303 } 310 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_unittest.cc ('k') | chrome/browser/autocomplete/autocomplete_popup_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698