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 "base/feature_list.h" | 9 #include "base/feature_list.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 return; | 487 return; |
488 } | 488 } |
489 | 489 |
490 canvas->TileImageInt(g_top_shadow.Get(), 0, 0, width(), | 490 canvas->TileImageInt(g_top_shadow.Get(), 0, 0, width(), |
491 g_top_shadow.Get().height()); | 491 g_top_shadow.Get().height()); |
492 canvas->TileImageInt(g_bottom_shadow.Get(), 0, | 492 canvas->TileImageInt(g_bottom_shadow.Get(), 0, |
493 height() - g_bottom_shadow.Get().height(), width(), | 493 height() - g_bottom_shadow.Get().height(), width(), |
494 g_bottom_shadow.Get().height()); | 494 g_bottom_shadow.Get().height()); |
495 } | 495 } |
496 | 496 |
497 void OmniboxPopupContentsView::PaintChildren(const ui::PaintContext& context) { | 497 void OmniboxPopupContentsView::PaintChildren( |
| 498 const views::PaintInfo& paint_info) { |
498 if (base::FeatureList::IsEnabled(omnibox::kUIExperimentNarrowDropdown)) { | 499 if (base::FeatureList::IsEnabled(omnibox::kUIExperimentNarrowDropdown)) { |
499 View::PaintChildren(context); | 500 View::PaintChildren(paint_info); |
500 return; | 501 return; |
501 } | 502 } |
502 | 503 |
503 gfx::Rect contents_bounds = GetContentsBounds(); | 504 gfx::Rect contents_bounds = GetContentsBounds(); |
504 contents_bounds.Inset(0, g_top_shadow.Get().height(), 0, | 505 contents_bounds.Inset(0, g_top_shadow.Get().height(), 0, |
505 g_bottom_shadow.Get().height()); | 506 g_bottom_shadow.Get().height()); |
506 | 507 |
507 ui::ClipRecorder clip_recorder(context); | 508 ui::ClipRecorder clip_recorder(paint_info.context()); |
508 clip_recorder.ClipRect(contents_bounds); | 509 clip_recorder.ClipRect(contents_bounds); |
509 { | 510 { |
510 ui::PaintRecorder recorder(context, size()); | 511 ui::PaintRecorder recorder(paint_info.context(), size()); |
511 SkColor background_color = result_view_at(0)->GetColor( | 512 SkColor background_color = result_view_at(0)->GetColor( |
512 OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND); | 513 OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND); |
513 recorder.canvas()->DrawColor(background_color); | 514 recorder.canvas()->DrawColor(background_color); |
514 } | 515 } |
515 View::PaintChildren(context); | 516 View::PaintChildren(paint_info); |
516 } | 517 } |
517 | 518 |
518 //////////////////////////////////////////////////////////////////////////////// | 519 //////////////////////////////////////////////////////////////////////////////// |
519 // OmniboxPopupContentsView, private: | 520 // OmniboxPopupContentsView, private: |
520 | 521 |
521 views::View* OmniboxPopupContentsView::TargetForRect(views::View* root, | 522 views::View* OmniboxPopupContentsView::TargetForRect(views::View* root, |
522 const gfx::Rect& rect) { | 523 const gfx::Rect& rect) { |
523 CHECK_EQ(root, this); | 524 CHECK_EQ(root, this); |
524 return this; | 525 return this; |
525 } | 526 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 size_t index = GetIndexForPoint(event.location()); | 566 size_t index = GetIndexForPoint(event.location()); |
566 if (!HasMatchAt(index)) | 567 if (!HasMatchAt(index)) |
567 return; | 568 return; |
568 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, | 569 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, |
569 GURL(), base::string16(), index); | 570 GURL(), base::string16(), index); |
570 } | 571 } |
571 | 572 |
572 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 573 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
573 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 574 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
574 } | 575 } |
OLD | NEW |