| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 #endif | 90 #endif |
| 91 find_text_(NULL), | 91 find_text_(NULL), |
| 92 match_count_text_(NULL), | 92 match_count_text_(NULL), |
| 93 focus_forwarder_view_(NULL), | 93 focus_forwarder_view_(NULL), |
| 94 find_previous_button_(NULL), | 94 find_previous_button_(NULL), |
| 95 find_next_button_(NULL), | 95 find_next_button_(NULL), |
| 96 close_button_(NULL) { | 96 close_button_(NULL) { |
| 97 SetID(VIEW_ID_FIND_IN_PAGE); | 97 SetID(VIEW_ID_FIND_IN_PAGE); |
| 98 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 98 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 99 | 99 |
| 100 find_text_ = new SearchTextfieldView(); | 100 find_text_ = new views::Textfield(); |
| 101 find_text_->SetID(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); | 101 find_text_->SetID(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); |
| 102 find_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont)); | 102 find_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont)); |
| 103 find_text_->set_default_width_in_chars(kDefaultCharWidth); | 103 find_text_->set_default_width_in_chars(kDefaultCharWidth); |
| 104 find_text_->SetController(this); | 104 find_text_->SetController(this); |
| 105 find_text_->SetAccessibleName( | 105 find_text_->SetAccessibleName( |
| 106 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_FIND))); | 106 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_FIND))); |
| 107 AddChildView(find_text_); | 107 AddChildView(find_text_); |
| 108 | 108 |
| 109 match_count_text_ = new views::Label(); | 109 match_count_text_ = new views::Label(); |
| 110 match_count_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont)); | 110 match_count_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont)); |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 | 541 |
| 542 bool FindBarView::FocusForwarderView::OnMousePressed( | 542 bool FindBarView::FocusForwarderView::OnMousePressed( |
| 543 const views::MouseEvent& event) { | 543 const views::MouseEvent& event) { |
| 544 if (view_to_focus_on_mousedown_) { | 544 if (view_to_focus_on_mousedown_) { |
| 545 view_to_focus_on_mousedown_->ClearSelection(); | 545 view_to_focus_on_mousedown_->ClearSelection(); |
| 546 view_to_focus_on_mousedown_->RequestFocus(); | 546 view_to_focus_on_mousedown_->RequestFocus(); |
| 547 } | 547 } |
| 548 return true; | 548 return true; |
| 549 } | 549 } |
| 550 | 550 |
| 551 FindBarView::SearchTextfieldView::SearchTextfieldView() { | |
| 552 } | |
| 553 | |
| 554 FindBarView::SearchTextfieldView::~SearchTextfieldView() { | |
| 555 } | |
| 556 | |
| 557 void FindBarView::SearchTextfieldView::RequestFocus() { | |
| 558 views::View::RequestFocus(); | |
| 559 SelectAll(); | |
| 560 } | |
| 561 | |
| 562 FindBarHost* FindBarView::find_bar_host() const { | 551 FindBarHost* FindBarView::find_bar_host() const { |
| 563 return static_cast<FindBarHost*>(host()); | 552 return static_cast<FindBarHost*>(host()); |
| 564 } | 553 } |
| 565 | 554 |
| 566 void FindBarView::OnThemeChanged() { | 555 void FindBarView::OnThemeChanged() { |
| 567 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 556 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 568 if (GetThemeProvider()) { | 557 if (GetThemeProvider()) { |
| 569 close_button_->SetBackground( | 558 close_button_->SetBackground( |
| 570 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TAB_TEXT), | 559 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TAB_TEXT), |
| 571 rb.GetBitmapNamed(IDR_CLOSE_BAR), | 560 rb.GetBitmapNamed(IDR_CLOSE_BAR), |
| 572 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); | 561 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); |
| 573 } | 562 } |
| 574 } | 563 } |
| OLD | NEW |