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

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

Issue 2849953004: SV Test
Patch Set: Created 3 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 "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "chrome/browser/search/search.h" 12 #include "chrome/browser/search/search.h"
13 #include "chrome/browser/themes/theme_properties.h" 13 #include "chrome/browser/themes/theme_properties.h"
14 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 14 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
15 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" 15 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h"
16 #include "chrome/browser/ui/views/theme_copying_widget.h" 16 #include "chrome/browser/ui/views/theme_copying_widget.h"
17 #include "components/omnibox/browser/omnibox_view.h" 17 #include "components/omnibox/browser/omnibox_view.h"
18 #include "third_party/skia/include/core/SkDrawLooper.h" 18 #include "third_party/skia/include/core/SkDrawLooper.h"
19 #include "ui/base/theme_provider.h" 19 #include "ui/base/theme_provider.h"
20 #include "ui/compositor/clip_recorder.h" 20 #include "ui/compositor/clip_recorder.h"
21 #include "ui/compositor/paint_context.h"
21 #include "ui/compositor/paint_recorder.h" 22 #include "ui/compositor/paint_recorder.h"
22 #include "ui/gfx/canvas.h" 23 #include "ui/gfx/canvas.h"
23 #include "ui/gfx/geometry/safe_integer_conversions.h" 24 #include "ui/gfx/geometry/safe_integer_conversions.h"
24 #include "ui/gfx/image/image.h" 25 #include "ui/gfx/image/image.h"
25 #include "ui/gfx/image/image_skia_operations.h" 26 #include "ui/gfx/image/image_skia_operations.h"
26 #include "ui/gfx/path.h" 27 #include "ui/gfx/path.h"
27 #include "ui/gfx/shadow_value.h" 28 #include "ui/gfx/shadow_value.h"
28 #include "ui/views/controls/image_view.h" 29 #include "ui/views/controls/image_view.h"
29 #include "ui/views/view_targeter.h" 30 #include "ui/views/view_targeter.h"
30 #include "ui/views/widget/widget.h" 31 #include "ui/views/widget/widget.h"
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 height() - g_bottom_shadow.Get().height(), width(), 462 height() - g_bottom_shadow.Get().height(), width(),
462 g_bottom_shadow.Get().height()); 463 g_bottom_shadow.Get().height());
463 } 464 }
464 465
465 void OmniboxPopupContentsView::PaintChildren(const ui::PaintContext& context) { 466 void OmniboxPopupContentsView::PaintChildren(const ui::PaintContext& context) {
466 gfx::Rect contents_bounds = GetContentsBounds(); 467 gfx::Rect contents_bounds = GetContentsBounds();
467 contents_bounds.Inset(0, g_top_shadow.Get().height(), 0, 468 contents_bounds.Inset(0, g_top_shadow.Get().height(), 0,
468 g_bottom_shadow.Get().height()); 469 g_bottom_shadow.Get().height());
469 470
470 ui::ClipRecorder clip_recorder(context); 471 ui::ClipRecorder clip_recorder(context);
471 clip_recorder.ClipRect(contents_bounds); 472
473
474
475 gfx::Rect scaled_bounds = gfx::ScaleToEnclosingRect(
476 contents_bounds, context.device_scale_factor(),
477 context.device_scale_factor());
478 clip_recorder.ClipRect(scaled_bounds);
472 { 479 {
473 ui::PaintRecorder recorder(context, size()); 480 ui::PaintRecorder recorder(context, size());
474 SkColor background_color = result_view_at(0)->GetColor( 481 SkColor background_color = result_view_at(0)->GetColor(
475 OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND); 482 OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND);
476 recorder.canvas()->DrawColor(background_color); 483 recorder.canvas()->DrawColor(background_color);
477 } 484 }
478 View::PaintChildren(context); 485 View::PaintChildren(context);
479 } 486 }
480 487
481 //////////////////////////////////////////////////////////////////////////////// 488 ////////////////////////////////////////////////////////////////////////////////
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 size_t index = GetIndexForPoint(event.location()); 535 size_t index = GetIndexForPoint(event.location());
529 if (!HasMatchAt(index)) 536 if (!HasMatchAt(index))
530 return; 537 return;
531 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, 538 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition,
532 GURL(), base::string16(), index); 539 GURL(), base::string16(), index);
533 } 540 }
534 541
535 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { 542 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) {
536 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); 543 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i)));
537 } 544 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | chrome/browser/ui/views/tabs/tab_strip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698