| 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" |
| 11 #include "chrome/browser/ui/views/layout_constants.h" | 11 #include "chrome/browser/ui/views/layout_constants.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 "components/omnibox/browser/omnibox_view.h" | 14 #include "components/omnibox/browser/omnibox_view.h" |
| 15 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
| 16 #include "ui/base/resource/material_design/material_design_controller.h" | 16 #include "ui/base/resource/material_design/material_design_controller.h" |
| 17 #include "ui/base/theme_provider.h" | 17 #include "ui/base/theme_provider.h" |
| 18 #include "ui/compositor/clip_transform_recorder.h" | 18 #include "ui/compositor/clip_recorder.h" |
| 19 #include "ui/compositor/paint_recorder.h" | 19 #include "ui/compositor/paint_recorder.h" |
| 20 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
| 21 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
| 22 #include "ui/gfx/path.h" | 22 #include "ui/gfx/path.h" |
| 23 #include "ui/resources/grit/ui_resources.h" | 23 #include "ui/resources/grit/ui_resources.h" |
| 24 #include "ui/views/controls/image_view.h" | 24 #include "ui/views/controls/image_view.h" |
| 25 #include "ui/views/resources/grit/views_resources.h" | 25 #include "ui/views/resources/grit/views_resources.h" |
| 26 #include "ui/views/view_targeter.h" | 26 #include "ui/views/view_targeter.h" |
| 27 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
| 28 #include "ui/views/window/non_client_view.h" | 28 #include "ui/views/window/non_client_view.h" |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 canvas->TileImageInt(*bottom_shadow_, 0, height() - bottom_shadow_->height(), | 458 canvas->TileImageInt(*bottom_shadow_, 0, height() - bottom_shadow_->height(), |
| 459 width(), bottom_shadow_->height()); | 459 width(), bottom_shadow_->height()); |
| 460 } | 460 } |
| 461 | 461 |
| 462 void OmniboxPopupContentsView::PaintChildren(const ui::PaintContext& context) { | 462 void OmniboxPopupContentsView::PaintChildren(const ui::PaintContext& context) { |
| 463 gfx::Rect contents_bounds = GetContentsBounds(); | 463 gfx::Rect contents_bounds = GetContentsBounds(); |
| 464 const int interior = GetLayoutConstant(OMNIBOX_DROPDOWN_BORDER_INTERIOR); | 464 const int interior = GetLayoutConstant(OMNIBOX_DROPDOWN_BORDER_INTERIOR); |
| 465 contents_bounds.Inset(0, views::NonClientFrameView::kClientEdgeThickness, 0, | 465 contents_bounds.Inset(0, views::NonClientFrameView::kClientEdgeThickness, 0, |
| 466 bottom_shadow_->height() - interior); | 466 bottom_shadow_->height() - interior); |
| 467 | 467 |
| 468 ui::ClipTransformRecorder clip_transform_recorder(context); | 468 ui::ClipRecorder clip_recorder(context); |
| 469 clip_transform_recorder.ClipRect(contents_bounds); | 469 clip_recorder.ClipRect(contents_bounds); |
| 470 { | 470 { |
| 471 ui::PaintRecorder recorder(context, size()); | 471 ui::PaintRecorder recorder(context, size()); |
| 472 SkColor background_color = result_view_at(0)->GetColor( | 472 SkColor background_color = result_view_at(0)->GetColor( |
| 473 OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND); | 473 OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND); |
| 474 recorder.canvas()->DrawColor(background_color); | 474 recorder.canvas()->DrawColor(background_color); |
| 475 } | 475 } |
| 476 View::PaintChildren(context); | 476 View::PaintChildren(context); |
| 477 } | 477 } |
| 478 | 478 |
| 479 //////////////////////////////////////////////////////////////////////////////// | 479 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 size_t index = GetIndexForPoint(event.location()); | 526 size_t index = GetIndexForPoint(event.location()); |
| 527 if (!HasMatchAt(index)) | 527 if (!HasMatchAt(index)) |
| 528 return; | 528 return; |
| 529 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, | 529 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, |
| 530 GURL(), base::string16(), index); | 530 GURL(), base::string16(), index); |
| 531 } | 531 } |
| 532 | 532 |
| 533 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 533 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
| 534 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 534 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
| 535 } | 535 } |
| OLD | NEW |