OLD | NEW |
---|---|
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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 font_list); | 401 font_list); |
402 } | 402 } |
403 | 403 |
404 //////////////////////////////////////////////////////////////////////////////// | 404 //////////////////////////////////////////////////////////////////////////////// |
405 // OmniboxPopupContentsView, views::View overrides, private: | 405 // OmniboxPopupContentsView, views::View overrides, private: |
406 | 406 |
407 const char* OmniboxPopupContentsView::GetClassName() const { | 407 const char* OmniboxPopupContentsView::GetClassName() const { |
408 return "OmniboxPopupContentsView"; | 408 return "OmniboxPopupContentsView"; |
409 } | 409 } |
410 | 410 |
411 void OmniboxPopupContentsView::OnPaint(gfx::Canvas* canvas) { | 411 void OmniboxPopupContentsView::PaintChildren(gfx::Canvas* canvas, |
412 const views::CullSet& cull_set) { | |
412 gfx::Rect contents_bounds = GetContentsBounds(); | 413 gfx::Rect contents_bounds = GetContentsBounds(); |
413 contents_bounds.set_height( | 414 contents_bounds.set_height( |
414 contents_bounds.height() - bottom_shadow_->height() + kBorderInterior); | 415 contents_bounds.height() - bottom_shadow_->height() + kBorderInterior); |
415 | 416 |
416 gfx::Path path; | 417 gfx::Path path; |
417 MakeContentsPath(&path, contents_bounds); | 418 MakeContentsPath(&path, contents_bounds); |
418 canvas->Save(); | 419 canvas->Save(); |
419 canvas->sk_canvas()->clipPath(path, | 420 canvas->sk_canvas()->clipPath(path, |
420 SkRegion::kIntersect_Op, | 421 SkRegion::kIntersect_Op, |
421 true /* doAntialias */); | 422 true /* doAntialias */); |
422 PaintResultViews(canvas); | 423 PaintResultViews(canvas); |
423 canvas->Restore(); | 424 canvas->Restore(); |
424 | 425 |
425 // Top border. | 426 // Top border. |
Peter Kasting
2015/03/26 03:02:55
Seems like maybe painting the top and bottom borde
| |
426 canvas->FillRect( | 427 canvas->FillRect( |
427 gfx::Rect(0, 0, width(), views::NonClientFrameView::kClientEdgeThickness), | 428 gfx::Rect(0, 0, width(), views::NonClientFrameView::kClientEdgeThickness), |
428 ThemeProperties::GetDefaultColor( | 429 ThemeProperties::GetDefaultColor( |
429 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 430 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
430 | 431 |
431 // Bottom border. | 432 // Bottom border. |
432 canvas->TileImageInt(*bottom_shadow_, 0, height() - bottom_shadow_->height(), | 433 canvas->TileImageInt(*bottom_shadow_, 0, height() - bottom_shadow_->height(), |
433 width(), bottom_shadow_->height()); | 434 width(), bottom_shadow_->height()); |
434 } | 435 } |
435 | 436 |
436 void OmniboxPopupContentsView::PaintChildren(gfx::Canvas* canvas, | |
437 const views::CullSet& cull_set) { | |
438 // We paint our children inside OnPaint(). | |
439 } | |
440 | |
441 //////////////////////////////////////////////////////////////////////////////// | 437 //////////////////////////////////////////////////////////////////////////////// |
442 // OmniboxPopupContentsView, private: | 438 // OmniboxPopupContentsView, private: |
443 | 439 |
444 views::View* OmniboxPopupContentsView::TargetForRect(views::View* root, | 440 views::View* OmniboxPopupContentsView::TargetForRect(views::View* root, |
445 const gfx::Rect& rect) { | 441 const gfx::Rect& rect) { |
446 CHECK_EQ(root, this); | 442 CHECK_EQ(root, this); |
447 return this; | 443 return this; |
448 } | 444 } |
449 | 445 |
450 bool OmniboxPopupContentsView::HasMatchAt(size_t index) const { | 446 bool OmniboxPopupContentsView::HasMatchAt(size_t index) const { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 size_t index = GetIndexForPoint(event.location()); | 495 size_t index = GetIndexForPoint(event.location()); |
500 if (!HasMatchAt(index)) | 496 if (!HasMatchAt(index)) |
501 return; | 497 return; |
502 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, | 498 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, |
503 GURL(), base::string16(), index); | 499 GURL(), base::string16(), index); |
504 } | 500 } |
505 | 501 |
506 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 502 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
507 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 503 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
508 } | 504 } |
OLD | NEW |