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 // For WinDDK ATL compatibility, these ATL headers must come first. | 5 // For WinDDK ATL compatibility, these ATL headers must come first. |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <atlbase.h> // NOLINT | 8 #include <atlbase.h> // NOLINT |
9 #include <atlwin.h> // NOLINT | 9 #include <atlwin.h> // NOLINT |
10 #endif | 10 #endif |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 return right_ - x; | 96 return right_ - x; |
97 } | 97 } |
98 | 98 |
99 private: | 99 private: |
100 int center_; | 100 int center_; |
101 int right_; | 101 int right_; |
102 | 102 |
103 DISALLOW_COPY_AND_ASSIGN(MirroringContext); | 103 DISALLOW_COPY_AND_ASSIGN(MirroringContext); |
104 }; | 104 }; |
105 | 105 |
106 OmniboxResultView::OmniboxResultView( | 106 OmniboxResultView::OmniboxResultView(OmniboxResultViewModel* model, |
107 OmniboxResultViewModel* model, | 107 int model_index, |
108 int model_index, | 108 LocationBarView* location_bar_view, |
109 LocationBarView* location_bar_view, | 109 const gfx::FontList& font_list) |
110 const gfx::FontList& font_list) | |
111 : edge_item_padding_(LocationBarView::GetItemPadding()), | 110 : edge_item_padding_(LocationBarView::GetItemPadding()), |
112 item_padding_(LocationBarView::GetItemPadding()), | 111 item_padding_(LocationBarView::GetItemPadding()), |
113 minimum_text_vertical_padding_(kMinimumTextVerticalPadding), | 112 minimum_text_vertical_padding_(kMinimumTextVerticalPadding), |
114 model_(model), | 113 model_(model), |
115 model_index_(model_index), | 114 model_index_(model_index), |
116 location_bar_view_(location_bar_view), | 115 location_bar_view_(location_bar_view), |
117 font_list_(font_list), | 116 font_list_(font_list), |
118 font_height_(std::max(font_list.GetHeight(), | 117 font_height_( |
119 font_list.DeriveFontList(gfx::BOLD).GetHeight())), | 118 std::max(font_list.GetHeight(), |
| 119 font_list.DeriveFontList(gfx::Font::BOLD).GetHeight())), |
120 ellipsis_width_(font_list.GetPrimaryFont().GetStringWidth( | 120 ellipsis_width_(font_list.GetPrimaryFont().GetStringWidth( |
121 string16(kEllipsis))), | 121 string16(kEllipsis))), |
122 mirroring_context_(new MirroringContext()), | 122 mirroring_context_(new MirroringContext()), |
123 keyword_icon_(new views::ImageView()), | 123 keyword_icon_(new views::ImageView()), |
124 animation_(new gfx::SlideAnimation(this)) { | 124 animation_(new gfx::SlideAnimation(this)) { |
125 CHECK_GE(model_index, 0); | 125 CHECK_GE(model_index, 0); |
126 if (default_icon_size_ == 0) { | 126 if (default_icon_size_ == 0) { |
127 default_icon_size_ = | 127 default_icon_size_ = |
128 location_bar_view_->GetThemeProvider()->GetImageSkiaNamed( | 128 location_bar_view_->GetThemeProvider()->GetImageSkiaNamed( |
129 AutocompleteMatch::TypeToIcon( | 129 AutocompleteMatch::TypeToIcon( |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 int x = GetMirroredXForRect(keyword_text_bounds_); | 622 int x = GetMirroredXForRect(keyword_text_bounds_); |
623 mirroring_context_->Initialize(x, keyword_text_bounds_.width()); | 623 mirroring_context_->Initialize(x, keyword_text_bounds_.width()); |
624 PaintMatch(canvas, *match_.associated_keyword.get(), x); | 624 PaintMatch(canvas, *match_.associated_keyword.get(), x); |
625 } | 625 } |
626 } | 626 } |
627 | 627 |
628 void OmniboxResultView::AnimationProgressed(const gfx::Animation* animation) { | 628 void OmniboxResultView::AnimationProgressed(const gfx::Animation* animation) { |
629 Layout(); | 629 Layout(); |
630 SchedulePaint(); | 630 SchedulePaint(); |
631 } | 631 } |
OLD | NEW |