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