| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 // The focus forwarder view is a hidden view that should cover the area | 337 // The focus forwarder view is a hidden view that should cover the area |
| 338 // between the find text box and the find button so that when the user clicks | 338 // between the find text box and the find button so that when the user clicks |
| 339 // in that area we focus on the find text box. | 339 // in that area we focus on the find text box. |
| 340 const int find_text_edge = find_text_->x() + find_text_->width(); | 340 const int find_text_edge = find_text_->x() + find_text_->width(); |
| 341 focus_forwarder_view_->SetBounds( | 341 focus_forwarder_view_->SetBounds( |
| 342 find_text_edge, find_previous_button_->y(), | 342 find_text_edge, find_previous_button_->y(), |
| 343 find_previous_button_->x() - find_text_edge, | 343 find_previous_button_->x() - find_text_edge, |
| 344 find_previous_button_->height()); | 344 find_previous_button_->height()); |
| 345 } | 345 } |
| 346 | 346 |
| 347 const char* FindBarView::GetClassName() const { |
| 348 return "FindBarView"; |
| 349 } |
| 350 |
| 347 gfx::Size FindBarView::GetPreferredSize() const { | 351 gfx::Size FindBarView::GetPreferredSize() const { |
| 348 gfx::Size prefsize = find_text_->GetPreferredSize(); | 352 gfx::Size prefsize = find_text_->GetPreferredSize(); |
| 349 prefsize.set_height(preferred_height_); | 353 prefsize.set_height(preferred_height_); |
| 350 | 354 |
| 351 // Add up all the preferred sizes and margins of the rest of the controls. | 355 // Add up all the preferred sizes and margins of the rest of the controls. |
| 352 prefsize.Enlarge(kMarginLeftOfCloseButton + kMarginRightOfCloseButton + | 356 prefsize.Enlarge(kMarginLeftOfCloseButton + kMarginRightOfCloseButton + |
| 353 kMarginLeftOfFindTextfield - | 357 kMarginLeftOfFindTextfield - |
| 354 find_text_->GetInsets().width(), | 358 find_text_->GetInsets().width(), |
| 355 0); | 359 0); |
| 356 prefsize.Enlarge(find_previous_button_->GetPreferredSize().width(), 0); | 360 prefsize.Enlarge(find_previous_button_->GetPreferredSize().width(), 0); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 | 501 |
| 498 void FindBarView::OnThemeChanged() { | 502 void FindBarView::OnThemeChanged() { |
| 499 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 503 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 500 if (GetThemeProvider()) { | 504 if (GetThemeProvider()) { |
| 501 close_button_->SetBackground( | 505 close_button_->SetBackground( |
| 502 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT), | 506 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT), |
| 503 rb.GetImageSkiaNamed(IDR_CLOSE_1), | 507 rb.GetImageSkiaNamed(IDR_CLOSE_1), |
| 504 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); | 508 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); |
| 505 } | 509 } |
| 506 } | 510 } |
| OLD | NEW |