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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc

Issue 275183002: patch from issue 218843002 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 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
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/ui/views/omnibox/omnibox_popup_contents_view.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/browser/search/search.h" 9 #include "chrome/browser/search/search.h"
10 #include "chrome/browser/themes/theme_properties.h" 10 #include "chrome/browser/themes/theme_properties.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 event->SetHandled(); 364 event->SetHandled();
365 } 365 }
366 366
367 //////////////////////////////////////////////////////////////////////////////// 367 ////////////////////////////////////////////////////////////////////////////////
368 // OmniboxPopupContentsView, protected: 368 // OmniboxPopupContentsView, protected:
369 369
370 void OmniboxPopupContentsView::PaintResultViews(gfx::Canvas* canvas) { 370 void OmniboxPopupContentsView::PaintResultViews(gfx::Canvas* canvas) {
371 canvas->DrawColor(result_view_at(0)->GetColor( 371 canvas->DrawColor(result_view_at(0)->GetColor(
372 OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND)); 372 OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND));
373 View::PaintChildren(canvas); 373 View::PaintChildren(canvas, views::CullSet());
374 } 374 }
375 375
376 int OmniboxPopupContentsView::CalculatePopupHeight() { 376 int OmniboxPopupContentsView::CalculatePopupHeight() {
377 DCHECK_GE(static_cast<size_t>(child_count()), model_->result().size()); 377 DCHECK_GE(static_cast<size_t>(child_count()), model_->result().size());
378 int popup_height = 0; 378 int popup_height = 0;
379 for (size_t i = model_->result().ShouldHideTopMatch() ? 1 : 0; 379 for (size_t i = model_->result().ShouldHideTopMatch() ? 1 : 0;
380 i < model_->result().size(); ++i) 380 i < model_->result().size(); ++i)
381 popup_height += child_at(i)->GetPreferredSize().height(); 381 popup_height += child_at(i)->GetPreferredSize().height();
382 382
383 // Add enough space on the top and bottom so it looks like there is the same 383 // Add enough space on the top and bottom so it looks like there is the same
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 canvas->FillRect( 426 canvas->FillRect(
427 gfx::Rect(0, 0, width(), views::NonClientFrameView::kClientEdgeThickness), 427 gfx::Rect(0, 0, width(), views::NonClientFrameView::kClientEdgeThickness),
428 ThemeProperties::GetDefaultColor( 428 ThemeProperties::GetDefaultColor(
429 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); 429 ThemeProperties::COLOR_TOOLBAR_SEPARATOR));
430 430
431 // Bottom border. 431 // Bottom border.
432 canvas->TileImageInt(*bottom_shadow_, 0, height() - bottom_shadow_->height(), 432 canvas->TileImageInt(*bottom_shadow_, 0, height() - bottom_shadow_->height(),
433 width(), bottom_shadow_->height()); 433 width(), bottom_shadow_->height());
434 } 434 }
435 435
436 void OmniboxPopupContentsView::PaintChildren(gfx::Canvas* canvas) { 436 void OmniboxPopupContentsView::PaintChildren(gfx::Canvas* canvas,
437 const views::CullSet& cull_set) {
437 // We paint our children inside OnPaint(). 438 // We paint our children inside OnPaint().
438 } 439 }
439 440
440 //////////////////////////////////////////////////////////////////////////////// 441 ////////////////////////////////////////////////////////////////////////////////
441 // OmniboxPopupContentsView, private: 442 // OmniboxPopupContentsView, private:
442 443
443 bool OmniboxPopupContentsView::HasMatchAt(size_t index) const { 444 bool OmniboxPopupContentsView::HasMatchAt(size_t index) const {
444 return index < model_->result().size(); 445 return index < model_->result().size();
445 } 446 }
446 447
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 size_t index = GetIndexForPoint(event.location()); 493 size_t index = GetIndexForPoint(event.location());
493 if (!HasMatchAt(index)) 494 if (!HasMatchAt(index))
494 return; 495 return;
495 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, 496 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition,
496 GURL(), base::string16(), index); 497 GURL(), base::string16(), index);
497 } 498 }
498 499
499 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { 500 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) {
500 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); 501 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i)));
501 } 502 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h ('k') | chrome/browser/ui/views/tabs/tab_strip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698