| 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/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 // The focus forwarder view is a hidden view that should cover the area | 330 // The focus forwarder view is a hidden view that should cover the area |
| 331 // between the find text box and the find button so that when the user clicks | 331 // between the find text box and the find button so that when the user clicks |
| 332 // in that area we focus on the find text box. | 332 // in that area we focus on the find text box. |
| 333 int find_text_edge = find_text_->x() + find_text_->width(); | 333 int find_text_edge = find_text_->x() + find_text_->width(); |
| 334 focus_forwarder_view_->SetBounds( | 334 focus_forwarder_view_->SetBounds( |
| 335 find_text_edge, find_previous_button_->y(), | 335 find_text_edge, find_previous_button_->y(), |
| 336 find_previous_button_->x() - find_text_edge, | 336 find_previous_button_->x() - find_text_edge, |
| 337 find_previous_button_->height()); | 337 find_previous_button_->height()); |
| 338 } | 338 } |
| 339 | 339 |
| 340 gfx::Size FindBarView::GetPreferredSize() { | 340 gfx::Size FindBarView::GetPreferredSize() const { |
| 341 gfx::Size prefsize = find_text_->GetPreferredSize(); | 341 gfx::Size prefsize = find_text_->GetPreferredSize(); |
| 342 prefsize.set_height(preferred_height_); | 342 prefsize.set_height(preferred_height_); |
| 343 | 343 |
| 344 // Add up all the preferred sizes and margins of the rest of the controls. | 344 // Add up all the preferred sizes and margins of the rest of the controls. |
| 345 prefsize.Enlarge(kMarginLeftOfCloseButton + kMarginRightOfCloseButton + | 345 prefsize.Enlarge(kMarginLeftOfCloseButton + kMarginRightOfCloseButton + |
| 346 kMarginLeftOfFindTextfield, | 346 kMarginLeftOfFindTextfield, |
| 347 0); | 347 0); |
| 348 prefsize.Enlarge(find_previous_button_->GetPreferredSize().width(), 0); | 348 prefsize.Enlarge(find_previous_button_->GetPreferredSize().width(), 0); |
| 349 prefsize.Enlarge(find_next_button_->GetPreferredSize().width(), 0); | 349 prefsize.Enlarge(find_next_button_->GetPreferredSize().width(), 0); |
| 350 prefsize.Enlarge(close_button_->GetPreferredSize().width(), 0); | 350 prefsize.Enlarge(close_button_->GetPreferredSize().width(), 0); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 489 |
| 490 void FindBarView::OnThemeChanged() { | 490 void FindBarView::OnThemeChanged() { |
| 491 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 491 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 492 if (GetThemeProvider()) { | 492 if (GetThemeProvider()) { |
| 493 close_button_->SetBackground( | 493 close_button_->SetBackground( |
| 494 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT), | 494 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT), |
| 495 rb.GetImageSkiaNamed(IDR_CLOSE_1), | 495 rb.GetImageSkiaNamed(IDR_CLOSE_1), |
| 496 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); | 496 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); |
| 497 } | 497 } |
| 498 } | 498 } |
| OLD | NEW |