| 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/location_bar/keyword_hint_view.h" | 5 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 DCHECK_EQ(2U, content_param_offsets.size()); | 106 DCHECK_EQ(2U, content_param_offsets.size()); |
| 107 leading_label_->SetText( | 107 leading_label_->SetText( |
| 108 keyword_hint.substr(0, content_param_offsets.front())); | 108 keyword_hint.substr(0, content_param_offsets.front())); |
| 109 trailing_label_->SetText(keyword_hint.substr(content_param_offsets.front())); | 109 trailing_label_->SetText(keyword_hint.substr(content_param_offsets.front())); |
| 110 } | 110 } |
| 111 | 111 |
| 112 gfx::Size KeywordHintView::GetPreferredSize() const { | 112 gfx::Size KeywordHintView::GetPreferredSize() const { |
| 113 // Height will be ignored by the LocationBarView. | 113 // Height will be ignored by the LocationBarView. |
| 114 return gfx::Size(leading_label_->GetPreferredSize().width() + | 114 return gfx::Size(leading_label_->GetPreferredSize().width() + |
| 115 tab_key_view_->GetPreferredSize().width() + | 115 tab_key_view_->GetPreferredSize().width() + |
| 116 trailing_label_->GetPreferredSize().width(), | 116 trailing_label_->GetPreferredSize().width() + |
| 117 LocationBarView::kIconInteriorPadding, |
| 117 0); | 118 0); |
| 118 } | 119 } |
| 119 | 120 |
| 120 gfx::Size KeywordHintView::GetMinimumSize() const { | 121 gfx::Size KeywordHintView::GetMinimumSize() const { |
| 121 // Height will be ignored by the LocationBarView. | 122 // Height will be ignored by the LocationBarView. |
| 122 return tab_key_view_->GetPreferredSize(); | 123 return tab_key_view_->GetPreferredSize(); |
| 123 } | 124 } |
| 124 | 125 |
| 125 void KeywordHintView::Layout() { | 126 void KeywordHintView::Layout() { |
| 126 int tab_width = tab_key_view_->GetPreferredSize().width(); | 127 int tab_width = tab_key_view_->GetPreferredSize().width(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 142 | 143 |
| 143 views::Label* KeywordHintView::CreateLabel(const gfx::FontList& font_list, | 144 views::Label* KeywordHintView::CreateLabel(const gfx::FontList& font_list, |
| 144 SkColor text_color, | 145 SkColor text_color, |
| 145 SkColor background_color) { | 146 SkColor background_color) { |
| 146 views::Label* label = new views::Label(base::string16(), font_list); | 147 views::Label* label = new views::Label(base::string16(), font_list); |
| 147 label->SetEnabledColor(text_color); | 148 label->SetEnabledColor(text_color); |
| 148 label->SetBackgroundColor(background_color); | 149 label->SetBackgroundColor(background_color); |
| 149 AddChildView(label); | 150 AddChildView(label); |
| 150 return label; | 151 return label; |
| 151 } | 152 } |
| OLD | NEW |