| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 text_box_background_left_(NULL) { | 79 text_box_background_left_(NULL) { |
| 80 set_id(VIEW_ID_FIND_IN_PAGE); | 80 set_id(VIEW_ID_FIND_IN_PAGE); |
| 81 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 81 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 82 | 82 |
| 83 find_text_ = new views::Textfield; | 83 find_text_ = new views::Textfield; |
| 84 find_text_->set_id(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); | 84 find_text_->set_id(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); |
| 85 find_text_->set_default_width_in_chars(kDefaultCharWidth); | 85 find_text_->set_default_width_in_chars(kDefaultCharWidth); |
| 86 find_text_->set_controller(this); | 86 find_text_->set_controller(this); |
| 87 find_text_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_FIND)); | 87 find_text_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_FIND)); |
| 88 // The find bar textfield has a background image instead of a border. | 88 // The find bar textfield has a background image instead of a border. |
| 89 find_text_->set_border(NULL); | 89 find_text_->SetBorder(views::Border::NullBorder()); |
| 90 AddChildView(find_text_); | 90 AddChildView(find_text_); |
| 91 | 91 |
| 92 match_count_text_ = new views::Label(); | 92 match_count_text_ = new views::Label(); |
| 93 AddChildView(match_count_text_); | 93 AddChildView(match_count_text_); |
| 94 | 94 |
| 95 // Create a focus forwarder view which sends focus to find_text_. | 95 // Create a focus forwarder view which sends focus to find_text_. |
| 96 focus_forwarder_view_ = new FocusForwarderView(find_text_); | 96 focus_forwarder_view_ = new FocusForwarderView(find_text_); |
| 97 AddChildView(focus_forwarder_view_); | 97 AddChildView(focus_forwarder_view_); |
| 98 | 98 |
| 99 find_previous_button_ = new views::ImageButton(this); | 99 find_previous_button_ = new views::ImageButton(this); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 close_button_->SetTooltipText( | 142 close_button_->SetTooltipText( |
| 143 l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP)); | 143 l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP)); |
| 144 close_button_->SetAccessibleName( | 144 close_button_->SetAccessibleName( |
| 145 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 145 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
| 146 close_button_->SetAnimationDuration(0); | 146 close_button_->SetAnimationDuration(0); |
| 147 AddChildView(close_button_); | 147 AddChildView(close_button_); |
| 148 | 148 |
| 149 SetBackground(rb.GetImageSkiaNamed(IDR_FIND_DLG_LEFT_BACKGROUND), | 149 SetBackground(rb.GetImageSkiaNamed(IDR_FIND_DLG_LEFT_BACKGROUND), |
| 150 rb.GetImageSkiaNamed(IDR_FIND_DLG_RIGHT_BACKGROUND)); | 150 rb.GetImageSkiaNamed(IDR_FIND_DLG_RIGHT_BACKGROUND)); |
| 151 | 151 |
| 152 SetBorder(IDR_FIND_DIALOG_LEFT, IDR_FIND_DIALOG_MIDDLE, | 152 SetBorderFromIds( |
| 153 IDR_FIND_DIALOG_RIGHT); | 153 IDR_FIND_DIALOG_LEFT, IDR_FIND_DIALOG_MIDDLE, IDR_FIND_DIALOG_RIGHT); |
| 154 | 154 |
| 155 preferred_height_ = rb.GetImageSkiaNamed(IDR_FIND_DIALOG_MIDDLE)->height(); | 155 preferred_height_ = rb.GetImageSkiaNamed(IDR_FIND_DIALOG_MIDDLE)->height(); |
| 156 | 156 |
| 157 // Background images for the Find edit box. | 157 // Background images for the Find edit box. |
| 158 text_box_background_ = rb.GetImageSkiaNamed(IDR_FIND_BOX_BACKGROUND); | 158 text_box_background_ = rb.GetImageSkiaNamed(IDR_FIND_BOX_BACKGROUND); |
| 159 text_box_background_left_ = | 159 text_box_background_left_ = |
| 160 rb.GetImageSkiaNamed(IDR_FIND_BOX_BACKGROUND_LEFT); | 160 rb.GetImageSkiaNamed(IDR_FIND_BOX_BACKGROUND_LEFT); |
| 161 | 161 |
| 162 EnableCanvasFlippingForRTLUI(true); | 162 EnableCanvasFlippingForRTLUI(true); |
| 163 } | 163 } |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 492 |
| 493 void FindBarView::OnThemeChanged() { | 493 void FindBarView::OnThemeChanged() { |
| 494 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 494 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 495 if (GetThemeProvider()) { | 495 if (GetThemeProvider()) { |
| 496 close_button_->SetBackground( | 496 close_button_->SetBackground( |
| 497 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT), | 497 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT), |
| 498 rb.GetImageSkiaNamed(IDR_CLOSE_1), | 498 rb.GetImageSkiaNamed(IDR_CLOSE_1), |
| 499 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); | 499 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); |
| 500 } | 500 } |
| 501 } | 501 } |
| OLD | NEW |