| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 match_count_text_(NULL), | 74 match_count_text_(NULL), |
| 75 focus_forwarder_view_(NULL), | 75 focus_forwarder_view_(NULL), |
| 76 find_previous_button_(NULL), | 76 find_previous_button_(NULL), |
| 77 find_next_button_(NULL), | 77 find_next_button_(NULL), |
| 78 close_button_(NULL), | 78 close_button_(NULL), |
| 79 text_box_background_(NULL), | 79 text_box_background_(NULL), |
| 80 text_box_background_left_(NULL) { | 80 text_box_background_left_(NULL) { |
| 81 set_id(VIEW_ID_FIND_IN_PAGE); | 81 set_id(VIEW_ID_FIND_IN_PAGE); |
| 82 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 82 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 83 | 83 |
| 84 find_text_ = new SearchTextfieldView(); | 84 find_text_ = new views::Textfield(); |
| 85 find_text_->set_id(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); | 85 find_text_->set_id(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); |
| 86 find_text_->SetFont(rb.GetFont(ui::ResourceBundle::BaseFont)); | 86 find_text_->SetFont(rb.GetFont(ui::ResourceBundle::BaseFont)); |
| 87 find_text_->set_default_width_in_chars(kDefaultCharWidth); | 87 find_text_->set_default_width_in_chars(kDefaultCharWidth); |
| 88 find_text_->SetController(this); | 88 find_text_->SetController(this); |
| 89 find_text_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_FIND)); | 89 find_text_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_FIND)); |
| 90 | 90 |
| 91 AddChildView(find_text_); | 91 AddChildView(find_text_); |
| 92 | 92 |
| 93 match_count_text_ = new views::Label(); | 93 match_count_text_ = new views::Label(); |
| 94 match_count_text_->SetFont(rb.GetFont(ui::ResourceBundle::BaseFont)); | 94 match_count_text_->SetFont(rb.GetFont(ui::ResourceBundle::BaseFont)); |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 } | 491 } |
| 492 } | 492 } |
| 493 | 493 |
| 494 bool FindBarView::FocusForwarderView::OnMousePressed( | 494 bool FindBarView::FocusForwarderView::OnMousePressed( |
| 495 const ui::MouseEvent& event) { | 495 const ui::MouseEvent& event) { |
| 496 if (view_to_focus_on_mousedown_) | 496 if (view_to_focus_on_mousedown_) |
| 497 view_to_focus_on_mousedown_->RequestFocus(); | 497 view_to_focus_on_mousedown_->RequestFocus(); |
| 498 return true; | 498 return true; |
| 499 } | 499 } |
| 500 | 500 |
| 501 FindBarView::SearchTextfieldView::SearchTextfieldView() { | |
| 502 } | |
| 503 | |
| 504 FindBarView::SearchTextfieldView::~SearchTextfieldView() { | |
| 505 } | |
| 506 | |
| 507 void FindBarView::SearchTextfieldView::RequestFocus() { | |
| 508 if (HasFocus()) | |
| 509 return; | |
| 510 views::View::RequestFocus(); | |
| 511 SelectAll(true); | |
| 512 } | |
| 513 | |
| 514 FindBarHost* FindBarView::find_bar_host() const { | 501 FindBarHost* FindBarView::find_bar_host() const { |
| 515 return static_cast<FindBarHost*>(host()); | 502 return static_cast<FindBarHost*>(host()); |
| 516 } | 503 } |
| 517 | 504 |
| 518 void FindBarView::OnThemeChanged() { | 505 void FindBarView::OnThemeChanged() { |
| 519 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 506 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 520 if (GetThemeProvider()) { | 507 if (GetThemeProvider()) { |
| 521 close_button_->SetBackground( | 508 close_button_->SetBackground( |
| 522 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT), | 509 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT), |
| 523 rb.GetImageSkiaNamed(IDR_CLOSE_1), | 510 rb.GetImageSkiaNamed(IDR_CLOSE_1), |
| 524 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); | 511 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); |
| 525 } | 512 } |
| 526 } | 513 } |
| OLD | NEW |