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 "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 FindBarView::FindBarView(FindBarHost* host) | 69 FindBarView::FindBarView(FindBarHost* host) |
70 : DropdownBarView(host), | 70 : DropdownBarView(host), |
71 find_text_(NULL), | 71 find_text_(NULL), |
72 match_count_text_(NULL), | 72 match_count_text_(NULL), |
73 focus_forwarder_view_(NULL), | 73 focus_forwarder_view_(NULL), |
74 find_previous_button_(NULL), | 74 find_previous_button_(NULL), |
75 find_next_button_(NULL), | 75 find_next_button_(NULL), |
76 close_button_(NULL), | 76 close_button_(NULL), |
77 background_(NULL), | 77 background_(NULL), |
78 background_left_(NULL) { | 78 background_left_(NULL) { |
79 SetID(VIEW_ID_FIND_IN_PAGE); | 79 set_id(VIEW_ID_FIND_IN_PAGE); |
80 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 80 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
81 | 81 |
82 find_text_ = new SearchTextfieldView(); | 82 find_text_ = new SearchTextfieldView(); |
83 find_text_->SetID(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); | 83 find_text_->set_id(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); |
84 find_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont)); | 84 find_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont)); |
85 find_text_->set_default_width_in_chars(kDefaultCharWidth); | 85 find_text_->set_default_width_in_chars(kDefaultCharWidth); |
86 find_text_->SetController(this); | 86 find_text_->SetController(this); |
87 find_text_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_FIND)); | 87 find_text_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_FIND)); |
88 AddChildView(find_text_); | 88 AddChildView(find_text_); |
89 | 89 |
90 match_count_text_ = new views::Label(); | 90 match_count_text_ = new views::Label(); |
91 match_count_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont)); | 91 match_count_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont)); |
92 match_count_text_->SetColor(kTextColorMatchCount); | 92 match_count_text_->SetColor(kTextColorMatchCount); |
93 match_count_text_->SetHorizontalAlignment(views::Label::ALIGN_CENTER); | 93 match_count_text_->SetHorizontalAlignment(views::Label::ALIGN_CENTER); |
94 AddChildView(match_count_text_); | 94 AddChildView(match_count_text_); |
95 | 95 |
96 // Create a focus forwarder view which sends focus to find_text_. | 96 // Create a focus forwarder view which sends focus to find_text_. |
97 focus_forwarder_view_ = new FocusForwarderView(find_text_); | 97 focus_forwarder_view_ = new FocusForwarderView(find_text_); |
98 AddChildView(focus_forwarder_view_); | 98 AddChildView(focus_forwarder_view_); |
99 | 99 |
100 find_previous_button_ = new views::ImageButton(this); | 100 find_previous_button_ = new views::ImageButton(this); |
101 find_previous_button_->set_tag(FIND_PREVIOUS_TAG); | 101 find_previous_button_->set_tag(FIND_PREVIOUS_TAG); |
102 find_previous_button_->SetFocusable(true); | 102 find_previous_button_->set_focusable(true); |
103 find_previous_button_->SetImage(views::CustomButton::BS_NORMAL, | 103 find_previous_button_->SetImage(views::CustomButton::BS_NORMAL, |
104 rb.GetBitmapNamed(IDR_FINDINPAGE_PREV)); | 104 rb.GetBitmapNamed(IDR_FINDINPAGE_PREV)); |
105 find_previous_button_->SetImage(views::CustomButton::BS_HOT, | 105 find_previous_button_->SetImage(views::CustomButton::BS_HOT, |
106 rb.GetBitmapNamed(IDR_FINDINPAGE_PREV_H)); | 106 rb.GetBitmapNamed(IDR_FINDINPAGE_PREV_H)); |
107 find_previous_button_->SetImage(views::CustomButton::BS_DISABLED, | 107 find_previous_button_->SetImage(views::CustomButton::BS_DISABLED, |
108 rb.GetBitmapNamed(IDR_FINDINPAGE_PREV_P)); | 108 rb.GetBitmapNamed(IDR_FINDINPAGE_PREV_P)); |
109 find_previous_button_->SetTooltipText(UTF16ToWide( | 109 find_previous_button_->SetTooltipText(UTF16ToWide( |
110 l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP))); | 110 l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP))); |
111 find_previous_button_->SetAccessibleName( | 111 find_previous_button_->SetAccessibleName( |
112 l10n_util::GetStringUTF16(IDS_ACCNAME_PREVIOUS)); | 112 l10n_util::GetStringUTF16(IDS_ACCNAME_PREVIOUS)); |
113 AddChildView(find_previous_button_); | 113 AddChildView(find_previous_button_); |
114 | 114 |
115 find_next_button_ = new views::ImageButton(this); | 115 find_next_button_ = new views::ImageButton(this); |
116 find_next_button_->set_tag(FIND_NEXT_TAG); | 116 find_next_button_->set_tag(FIND_NEXT_TAG); |
117 find_next_button_->SetFocusable(true); | 117 find_next_button_->set_focusable(true); |
118 find_next_button_->SetImage(views::CustomButton::BS_NORMAL, | 118 find_next_button_->SetImage(views::CustomButton::BS_NORMAL, |
119 rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT)); | 119 rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT)); |
120 find_next_button_->SetImage(views::CustomButton::BS_HOT, | 120 find_next_button_->SetImage(views::CustomButton::BS_HOT, |
121 rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT_H)); | 121 rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT_H)); |
122 find_next_button_->SetImage(views::CustomButton::BS_DISABLED, | 122 find_next_button_->SetImage(views::CustomButton::BS_DISABLED, |
123 rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT_P)); | 123 rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT_P)); |
124 find_next_button_->SetTooltipText( | 124 find_next_button_->SetTooltipText( |
125 UTF16ToWide(l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_NEXT_TOOLTIP))); | 125 UTF16ToWide(l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_NEXT_TOOLTIP))); |
126 find_next_button_->SetAccessibleName( | 126 find_next_button_->SetAccessibleName( |
127 l10n_util::GetStringUTF16(IDS_ACCNAME_NEXT)); | 127 l10n_util::GetStringUTF16(IDS_ACCNAME_NEXT)); |
128 AddChildView(find_next_button_); | 128 AddChildView(find_next_button_); |
129 | 129 |
130 close_button_ = new views::ImageButton(this); | 130 close_button_ = new views::ImageButton(this); |
131 close_button_->set_tag(CLOSE_TAG); | 131 close_button_->set_tag(CLOSE_TAG); |
132 close_button_->SetFocusable(true); | 132 close_button_->set_focusable(true); |
133 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 133 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
134 rb.GetBitmapNamed(IDR_CLOSE_BAR)); | 134 rb.GetBitmapNamed(IDR_CLOSE_BAR)); |
135 close_button_->SetImage(views::CustomButton::BS_HOT, | 135 close_button_->SetImage(views::CustomButton::BS_HOT, |
136 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); | 136 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); |
137 close_button_->SetImage(views::CustomButton::BS_PUSHED, | 137 close_button_->SetImage(views::CustomButton::BS_PUSHED, |
138 rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); | 138 rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); |
139 close_button_->SetTooltipText( | 139 close_button_->SetTooltipText( |
140 UTF16ToWide(l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP))); | 140 UTF16ToWide(l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP))); |
141 close_button_->SetAccessibleName( | 141 close_button_->SetAccessibleName( |
142 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 142 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 484 |
485 void FindBarView::OnThemeChanged() { | 485 void FindBarView::OnThemeChanged() { |
486 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 486 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
487 if (GetThemeProvider()) { | 487 if (GetThemeProvider()) { |
488 close_button_->SetBackground( | 488 close_button_->SetBackground( |
489 GetThemeProvider()->GetColor(ThemeService::COLOR_TAB_TEXT), | 489 GetThemeProvider()->GetColor(ThemeService::COLOR_TAB_TEXT), |
490 rb.GetBitmapNamed(IDR_CLOSE_BAR), | 490 rb.GetBitmapNamed(IDR_CLOSE_BAR), |
491 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); | 491 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); |
492 } | 492 } |
493 } | 493 } |
OLD | NEW |