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

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

Issue 1053143002: Make View::Paint use ui::PaintRecorder to access PaintContext's canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: paintrecorder: . Created 5 years, 8 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"
11 #include "chrome/browser/ui/omnibox/omnibox_view.h" 11 #include "chrome/browser/ui/omnibox/omnibox_view.h"
12 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 12 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
13 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" 13 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h"
14 #include "ui/base/theme_provider.h" 14 #include "ui/base/theme_provider.h"
15 #include "ui/compositor/paint_context.h"
15 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
16 #include "ui/gfx/image/image.h" 17 #include "ui/gfx/image/image.h"
17 #include "ui/gfx/path.h" 18 #include "ui/gfx/path.h"
18 #include "ui/resources/grit/ui_resources.h" 19 #include "ui/resources/grit/ui_resources.h"
19 #include "ui/views/controls/image_view.h" 20 #include "ui/views/controls/image_view.h"
20 #include "ui/views/view_targeter.h" 21 #include "ui/views/view_targeter.h"
21 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
22 #include "ui/views/window/non_client_view.h" 23 #include "ui/views/window/non_client_view.h"
23 24
24 namespace { 25 namespace {
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 canvas->FillRect( 408 canvas->FillRect(
408 gfx::Rect(0, 0, width(), views::NonClientFrameView::kClientEdgeThickness), 409 gfx::Rect(0, 0, width(), views::NonClientFrameView::kClientEdgeThickness),
409 ThemeProperties::GetDefaultColor( 410 ThemeProperties::GetDefaultColor(
410 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); 411 ThemeProperties::COLOR_TOOLBAR_SEPARATOR));
411 412
412 // Bottom border. 413 // Bottom border.
413 canvas->TileImageInt(*bottom_shadow_, 0, height() - bottom_shadow_->height(), 414 canvas->TileImageInt(*bottom_shadow_, 0, height() - bottom_shadow_->height(),
414 width(), bottom_shadow_->height()); 415 width(), bottom_shadow_->height());
415 } 416 }
416 417
417 void OmniboxPopupContentsView::PaintChildren(const PaintContext& context) { 418 void OmniboxPopupContentsView::PaintChildren(const ui::PaintContext& context) {
418 gfx::Rect contents_bounds = GetContentsBounds(); 419 gfx::Rect contents_bounds = GetContentsBounds();
419 contents_bounds.Inset(0, views::NonClientFrameView::kClientEdgeThickness, 0, 420 contents_bounds.Inset(0, views::NonClientFrameView::kClientEdgeThickness, 0,
420 bottom_shadow_->height() - kBorderInterior); 421 bottom_shadow_->height() - kBorderInterior);
421 422
422 gfx::Canvas* canvas = context.canvas(); 423 gfx::Canvas* canvas = context.canvas();
423 canvas->Save(); 424 canvas->Save();
424 canvas->sk_canvas()->clipRect(gfx::RectToSkRect(contents_bounds), 425 canvas->sk_canvas()->clipRect(gfx::RectToSkRect(contents_bounds),
425 SkRegion::kIntersect_Op, 426 SkRegion::kIntersect_Op,
426 true /* doAntialias */); 427 true /* doAntialias */);
427 canvas->DrawColor(result_view_at(0)->GetColor(OmniboxResultView::NORMAL, 428 canvas->DrawColor(result_view_at(0)->GetColor(OmniboxResultView::NORMAL,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 size_t index = GetIndexForPoint(event.location()); 481 size_t index = GetIndexForPoint(event.location());
481 if (!HasMatchAt(index)) 482 if (!HasMatchAt(index))
482 return; 483 return;
483 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, 484 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition,
484 GURL(), base::string16(), index); 485 GURL(), base::string16(), index);
485 } 486 }
486 487
487 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { 488 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) {
488 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); 489 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i)));
489 } 490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698