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/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 #include "ui/native_theme/native_theme.h" | 40 #include "ui/native_theme/native_theme.h" |
41 #include "ui/resources/grit/ui_resources.h" | 41 #include "ui/resources/grit/ui_resources.h" |
42 #include "ui/views/background.h" | 42 #include "ui/views/background.h" |
43 #include "ui/views/border.h" | 43 #include "ui/views/border.h" |
44 #include "ui/views/bubble/bubble_border.h" | 44 #include "ui/views/bubble/bubble_border.h" |
45 #include "ui/views/controls/button/image_button.h" | 45 #include "ui/views/controls/button/image_button.h" |
46 #include "ui/views/controls/label.h" | 46 #include "ui/views/controls/label.h" |
47 #include "ui/views/controls/separator.h" | 47 #include "ui/views/controls/separator.h" |
48 #include "ui/views/layout/box_layout.h" | 48 #include "ui/views/layout/box_layout.h" |
49 #include "ui/views/painter.h" | 49 #include "ui/views/painter.h" |
| 50 #include "ui/views/style/platform_style.h" |
50 #include "ui/views/view_targeter.h" | 51 #include "ui/views/view_targeter.h" |
51 #include "ui/views/widget/widget.h" | 52 #include "ui/views/widget/widget.h" |
52 | 53 |
53 namespace { | 54 namespace { |
54 | 55 |
55 // The margins around the UI controls, derived from assets and design specs. | 56 // The margins around the UI controls, derived from assets and design specs. |
56 const int kMarginLeftOfCloseButton = 3; | 57 const int kMarginLeftOfCloseButton = 3; |
57 const int kMarginRightOfCloseButton = 7; | 58 const int kMarginRightOfCloseButton = 7; |
58 const int kMarginLeftOfMatchCountLabel = 3; | 59 const int kMarginLeftOfMatchCountLabel = 3; |
59 const int kMarginRightOfMatchCountLabel = 1; | 60 const int kMarginRightOfMatchCountLabel = 1; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 find_previous_button_ = find_previous; | 147 find_previous_button_ = find_previous; |
147 find_next_button_ = find_next; | 148 find_next_button_ = find_next; |
148 close_button_ = close; | 149 close_button_ = close; |
149 } else { | 150 } else { |
150 find_previous_button_ = new views::ImageButton(this); | 151 find_previous_button_ = new views::ImageButton(this); |
151 find_next_button_ = new views::ImageButton(this); | 152 find_next_button_ = new views::ImageButton(this); |
152 close_button_ = new views::ImageButton(this); | 153 close_button_ = new views::ImageButton(this); |
153 } | 154 } |
154 | 155 |
155 find_previous_button_->set_id(VIEW_ID_FIND_IN_PAGE_PREVIOUS_BUTTON); | 156 find_previous_button_->set_id(VIEW_ID_FIND_IN_PAGE_PREVIOUS_BUTTON); |
156 find_previous_button_->SetFocusable(true); | 157 views::PlatformStyle::SetControlStyleFocus(find_previous_button_); |
157 find_previous_button_->set_request_focus_on_press(false); | 158 find_previous_button_->set_request_focus_on_press(false); |
158 find_previous_button_->SetTooltipText( | 159 find_previous_button_->SetTooltipText( |
159 l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP)); | 160 l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP)); |
160 find_previous_button_->SetAccessibleName( | 161 find_previous_button_->SetAccessibleName( |
161 l10n_util::GetStringUTF16(IDS_ACCNAME_PREVIOUS)); | 162 l10n_util::GetStringUTF16(IDS_ACCNAME_PREVIOUS)); |
162 AddChildView(find_previous_button_); | 163 AddChildView(find_previous_button_); |
163 | 164 |
164 find_next_button_->set_id(VIEW_ID_FIND_IN_PAGE_NEXT_BUTTON); | 165 find_next_button_->set_id(VIEW_ID_FIND_IN_PAGE_NEXT_BUTTON); |
165 find_next_button_->SetFocusable(true); | 166 views::PlatformStyle::SetControlStyleFocus(find_next_button_); |
166 find_next_button_->set_request_focus_on_press(false); | 167 find_next_button_->set_request_focus_on_press(false); |
167 find_next_button_->SetTooltipText( | 168 find_next_button_->SetTooltipText( |
168 l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_NEXT_TOOLTIP)); | 169 l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_NEXT_TOOLTIP)); |
169 find_next_button_->SetAccessibleName( | 170 find_next_button_->SetAccessibleName( |
170 l10n_util::GetStringUTF16(IDS_ACCNAME_NEXT)); | 171 l10n_util::GetStringUTF16(IDS_ACCNAME_NEXT)); |
171 AddChildView(find_next_button_); | 172 AddChildView(find_next_button_); |
172 | 173 |
173 close_button_->set_id(VIEW_ID_FIND_IN_PAGE_CLOSE_BUTTON); | 174 close_button_->set_id(VIEW_ID_FIND_IN_PAGE_CLOSE_BUTTON); |
174 close_button_->SetFocusable(true); | 175 views::PlatformStyle::SetControlStyleFocus(close_button_); |
175 close_button_->set_request_focus_on_press(false); | 176 close_button_->set_request_focus_on_press(false); |
176 close_button_->SetTooltipText( | 177 close_button_->SetTooltipText( |
177 l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP)); | 178 l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP)); |
178 close_button_->SetAccessibleName( | 179 close_button_->SetAccessibleName( |
179 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 180 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
180 close_button_->SetAnimationDuration(0); | 181 close_button_->SetAnimationDuration(0); |
181 AddChildView(close_button_); | 182 AddChildView(close_button_); |
182 | 183 |
183 // Create a focus forwarder view which sends focus to find_text_. | 184 // Create a focus forwarder view which sends focus to find_text_. |
184 focus_forwarder_view_ = new FocusForwarderView(find_text_); | 185 focus_forwarder_view_ = new FocusForwarderView(find_text_); |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 SkColor text_color = | 664 SkColor text_color = |
664 theme->GetSystemColor(ui::NativeTheme::kColorId_TextfieldDefaultColor); | 665 theme->GetSystemColor(ui::NativeTheme::kColorId_TextfieldDefaultColor); |
665 match_count_text_->SetEnabledColor(SkColorSetA(text_color, 0x69)); | 666 match_count_text_->SetEnabledColor(SkColorSetA(text_color, 0x69)); |
666 separator_->SetColor(SkColorSetA(text_color, 0x26)); | 667 separator_->SetColor(SkColorSetA(text_color, 0x26)); |
667 } | 668 } |
668 | 669 |
669 SkColor FindBarView::GetTextColorForIcon() { | 670 SkColor FindBarView::GetTextColorForIcon() { |
670 return GetNativeTheme()->GetSystemColor( | 671 return GetNativeTheme()->GetSystemColor( |
671 ui::NativeTheme::kColorId_TextfieldDefaultColor); | 672 ui::NativeTheme::kColorId_TextfieldDefaultColor); |
672 } | 673 } |
OLD | NEW |