| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 switch (sender->tag()) { | 399 switch (sender->tag()) { |
| 400 case FIND_PREVIOUS_TAG: | 400 case FIND_PREVIOUS_TAG: |
| 401 case FIND_NEXT_TAG: | 401 case FIND_NEXT_TAG: |
| 402 if (!find_text_->text().empty()) { | 402 if (!find_text_->text().empty()) { |
| 403 FindTabHelper* find_tab_helper = FindTabHelper::FromWebContents( | 403 FindTabHelper* find_tab_helper = FindTabHelper::FromWebContents( |
| 404 find_bar_host()->GetFindBarController()->web_contents()); | 404 find_bar_host()->GetFindBarController()->web_contents()); |
| 405 find_tab_helper->StartFinding(find_text_->text(), | 405 find_tab_helper->StartFinding(find_text_->text(), |
| 406 sender->tag() == FIND_NEXT_TAG, | 406 sender->tag() == FIND_NEXT_TAG, |
| 407 false); // Not case sensitive. | 407 false); // Not case sensitive. |
| 408 } | 408 } |
| 409 if (event.IsMouseEvent()) { | 409 // Move focus to the find textfield. |
| 410 // If mouse event, we move the focus back to the text-field, so that the | 410 find_text_->RequestFocus(); |
| 411 // user doesn't have to click on the text field to change the search. We | |
| 412 // don't want to do this for keyboard clicks on the button, since the | |
| 413 // user is more likely to press FindNext again than change the search | |
| 414 // query. | |
| 415 find_text_->RequestFocus(); | |
| 416 } | |
| 417 break; | 411 break; |
| 418 case CLOSE_TAG: | 412 case CLOSE_TAG: |
| 419 find_bar_host()->GetFindBarController()->EndFindSession( | 413 find_bar_host()->GetFindBarController()->EndFindSession( |
| 420 FindBarController::kKeepSelectionOnPage, | 414 FindBarController::kKeepSelectionOnPage, |
| 421 FindBarController::kKeepResultsInFindBox); | 415 FindBarController::kKeepResultsInFindBox); |
| 422 break; | 416 break; |
| 423 default: | 417 default: |
| 424 NOTREACHED() << L"Unknown button"; | 418 NOTREACHED() << L"Unknown button"; |
| 425 break; | 419 break; |
| 426 } | 420 } |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 void FindBarView::OnNativeThemeChanged(const ui::NativeTheme* theme) { | 655 void FindBarView::OnNativeThemeChanged(const ui::NativeTheme* theme) { |
| 662 if (!ui::MaterialDesignController::IsModeMaterial()) | 656 if (!ui::MaterialDesignController::IsModeMaterial()) |
| 663 return; | 657 return; |
| 664 | 658 |
| 665 SkColor color = | 659 SkColor color = |
| 666 theme->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground); | 660 theme->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground); |
| 667 set_background(views::Background::CreateSolidBackground(color)); | 661 set_background(views::Background::CreateSolidBackground(color)); |
| 668 match_count_text_->SetBackgroundColor(color); | 662 match_count_text_->SetBackgroundColor(color); |
| 669 match_count_text_->SetEnabledColor(kMatchTextColorMD); | 663 match_count_text_->SetEnabledColor(kMatchTextColorMD); |
| 670 } | 664 } |
| OLD | NEW |