| 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/i18n/number_formatting.h" |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 11 #include "base/strings/string_number_conversions.h" | |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/themes/theme_properties.h" | 15 #include "chrome/browser/themes/theme_properties.h" |
| 16 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 16 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 17 #include "chrome/browser/ui/find_bar/find_bar_state.h" | 17 #include "chrome/browser/ui/find_bar/find_bar_state.h" |
| 18 #include "chrome/browser/ui/find_bar/find_bar_state_factory.h" | 18 #include "chrome/browser/ui/find_bar/find_bar_state_factory.h" |
| 19 #include "chrome/browser/ui/find_bar/find_notification_details.h" | 19 #include "chrome/browser/ui/find_bar/find_notification_details.h" |
| 20 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 20 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 21 #include "chrome/browser/ui/view_ids.h" | 21 #include "chrome/browser/ui/view_ids.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 find_text_->SelectAll(true); | 229 find_text_->SelectAll(true); |
| 230 } | 230 } |
| 231 | 231 |
| 232 if (find_text.empty() || !have_valid_range) { | 232 if (find_text.empty() || !have_valid_range) { |
| 233 // If there was no text entered, we don't show anything in the result count | 233 // If there was no text entered, we don't show anything in the result count |
| 234 // area. | 234 // area. |
| 235 ClearMatchCount(); | 235 ClearMatchCount(); |
| 236 return; | 236 return; |
| 237 } | 237 } |
| 238 | 238 |
| 239 match_count_text_->SetText(l10n_util::GetStringFUTF16(IDS_FIND_IN_PAGE_COUNT, | 239 match_count_text_->SetText(l10n_util::GetStringFUTF16( |
| 240 base::IntToString16(result.active_match_ordinal()), | 240 IDS_FIND_IN_PAGE_COUNT, base::FormatNumber(result.active_match_ordinal()), |
| 241 base::IntToString16(result.number_of_matches()))); | 241 base::FormatNumber(result.number_of_matches()))); |
| 242 | 242 |
| 243 UpdateMatchCountAppearance(result.number_of_matches() == 0 && | 243 UpdateMatchCountAppearance(result.number_of_matches() == 0 && |
| 244 result.final_update()); | 244 result.final_update()); |
| 245 | 245 |
| 246 // The match_count label may have increased/decreased in size so we need to | 246 // The match_count label may have increased/decreased in size so we need to |
| 247 // do a layout and repaint the dialog so that the find text field doesn't | 247 // do a layout and repaint the dialog so that the find text field doesn't |
| 248 // partially overlap the match-count label when it increases on no matches. | 248 // partially overlap the match-count label when it increases on no matches. |
| 249 Layout(); | 249 Layout(); |
| 250 SchedulePaint(); | 250 SchedulePaint(); |
| 251 } | 251 } |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 SkColor text_color = | 654 SkColor text_color = |
| 655 theme->GetSystemColor(ui::NativeTheme::kColorId_TextfieldDefaultColor); | 655 theme->GetSystemColor(ui::NativeTheme::kColorId_TextfieldDefaultColor); |
| 656 match_count_text_->SetEnabledColor(SkColorSetA(text_color, 0x69)); | 656 match_count_text_->SetEnabledColor(SkColorSetA(text_color, 0x69)); |
| 657 separator_->SetColor(SkColorSetA(text_color, 0x26)); | 657 separator_->SetColor(SkColorSetA(text_color, 0x26)); |
| 658 } | 658 } |
| 659 | 659 |
| 660 SkColor FindBarView::GetTextColorForIcon() { | 660 SkColor FindBarView::GetTextColorForIcon() { |
| 661 return GetNativeTheme()->GetSystemColor( | 661 return GetNativeTheme()->GetSystemColor( |
| 662 ui::NativeTheme::kColorId_TextfieldDefaultColor); | 662 ui::NativeTheme::kColorId_TextfieldDefaultColor); |
| 663 } | 663 } |
| OLD | NEW |