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/find_bar_view.h" | 5 #include "chrome/browser/ui/views/find_bar_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 find_previous_button_->width(), | 303 find_previous_button_->width(), |
304 (height() - sz.height()) / 2, | 304 (height() - sz.height()) / 2, |
305 sz.width(), | 305 sz.width(), |
306 sz.height()); | 306 sz.height()); |
307 | 307 |
308 // Then the label showing the match count number. | 308 // Then the label showing the match count number. |
309 sz = match_count_text_->GetPreferredSize(); | 309 sz = match_count_text_->GetPreferredSize(); |
310 // We extend the label bounds a bit to give the background highlighting a bit | 310 // We extend the label bounds a bit to give the background highlighting a bit |
311 // of breathing room (margins around the text). | 311 // of breathing room (margins around the text). |
312 sz.Enlarge(kMatchCountExtraWidth, 0); | 312 sz.Enlarge(kMatchCountExtraWidth, 0); |
313 sz.ClampToMin(gfx::Size(kMatchCountMinWidth, 0)); | 313 sz.SetToMax(gfx::Size(kMatchCountMinWidth, 0)); |
314 int match_count_x = | 314 int match_count_x = |
315 find_previous_button_->x() - kWhiteSpaceAfterMatchCountLabel - sz.width(); | 315 find_previous_button_->x() - kWhiteSpaceAfterMatchCountLabel - sz.width(); |
316 int find_text_y = (height() - find_text_->GetPreferredSize().height()) / 2; | 316 int find_text_y = (height() - find_text_->GetPreferredSize().height()) / 2; |
317 match_count_text_->SetBounds(match_count_x, | 317 match_count_text_->SetBounds(match_count_x, |
318 find_text_y + find_text_->GetBaseline() - | 318 find_text_y + find_text_->GetBaseline() - |
319 match_count_text_->GetBaseline(), | 319 match_count_text_->GetBaseline(), |
320 sz.width(), sz.height()); | 320 sz.width(), sz.height()); |
321 | 321 |
322 // And whatever space is left in between, gets filled up by the find edit box. | 322 // And whatever space is left in between, gets filled up by the find edit box. |
323 int find_text_width = std::max(0, match_count_x - kMarginLeftOfFindTextfield); | 323 int find_text_width = std::max(0, match_count_x - kMarginLeftOfFindTextfield); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 | 522 |
523 void FindBarView::OnThemeChanged() { | 523 void FindBarView::OnThemeChanged() { |
524 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 524 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
525 if (GetThemeProvider()) { | 525 if (GetThemeProvider()) { |
526 close_button_->SetBackground( | 526 close_button_->SetBackground( |
527 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT), | 527 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT), |
528 rb.GetImageSkiaNamed(IDR_CLOSE_1), | 528 rb.GetImageSkiaNamed(IDR_CLOSE_1), |
529 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); | 529 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); |
530 } | 530 } |
531 } | 531 } |
OLD | NEW |