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

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

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: Update tests Created 3 years, 5 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 "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
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(const ui::PaintInfo& paint_info) {
498 if (base::FeatureList::IsEnabled(omnibox::kUIExperimentNarrowDropdown)) { 498 if (base::FeatureList::IsEnabled(omnibox::kUIExperimentNarrowDropdown)) {
499 View::PaintChildren(context); 499 View::PaintChildren(paint_info);
500 return; 500 return;
501 } 501 }
502 502
503 gfx::Rect contents_bounds = GetContentsBounds(); 503 gfx::Rect contents_bounds = GetContentsBounds();
504 contents_bounds.Inset(0, g_top_shadow.Get().height(), 0, 504 contents_bounds.Inset(0, g_top_shadow.Get().height(), 0,
505 g_bottom_shadow.Get().height()); 505 g_bottom_shadow.Get().height());
506 506
507 ui::ClipRecorder clip_recorder(context); 507 ui::ClipRecorder clip_recorder(paint_info.context());
508 clip_recorder.ClipRect(contents_bounds); 508 clip_recorder.ClipRect(contents_bounds);
509 { 509 {
510 ui::PaintRecorder recorder(context, size()); 510 ui::PaintRecorder recorder(paint_info.context(), size());
511 SkColor background_color = result_view_at(0)->GetColor( 511 SkColor background_color = result_view_at(0)->GetColor(
512 OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND); 512 OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND);
513 recorder.canvas()->DrawColor(background_color); 513 recorder.canvas()->DrawColor(background_color);
514 } 514 }
515 View::PaintChildren(context); 515 View::PaintChildren(paint_info);
516 } 516 }
517 517
518 //////////////////////////////////////////////////////////////////////////////// 518 ////////////////////////////////////////////////////////////////////////////////
519 // OmniboxPopupContentsView, private: 519 // OmniboxPopupContentsView, private:
520 520
521 views::View* OmniboxPopupContentsView::TargetForRect(views::View* root, 521 views::View* OmniboxPopupContentsView::TargetForRect(views::View* root,
522 const gfx::Rect& rect) { 522 const gfx::Rect& rect) {
523 CHECK_EQ(root, this); 523 CHECK_EQ(root, this);
524 return this; 524 return this;
525 } 525 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 size_t index = GetIndexForPoint(event.location()); 565 size_t index = GetIndexForPoint(event.location());
566 if (!HasMatchAt(index)) 566 if (!HasMatchAt(index))
567 return; 567 return;
568 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, 568 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition,
569 GURL(), base::string16(), index); 569 GURL(), base::string16(), index);
570 } 570 }
571 571
572 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { 572 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) {
573 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); 573 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i)));
574 } 574 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698