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 // As NotifyClick() now takes ui::Event directly so event can be mouse |
410 // If mouse event, we move the focus back to the text-field, so that the | 410 // event or the key event. |
411 // user doesn't have to click on the text field to change the search. We | 411 if (event.IsMouseEvent() || (event.IsKeyEvent() && |
412 // don't want to do this for keyboard clicks on the button, since the | 412 static_cast<const ui::KeyEvent&>(event) |
413 // user is more likely to press FindNext again than change the search | 413 .key_code() == ui::VKEY_RETURN)) { |
msw
2015/08/26 18:44:32
The same defect occurs for the space key, and perh
Deepak
2015/08/27 05:31:04
Thanks for detailed explanation. As the current is
msw
2015/08/27 18:09:02
Acknowledged.
| |
414 // query. | 414 // If mouse event or key event with Enter key, we move the focus back |
415 // to the text-field, so that the user doesn't have to click on the | |
416 // text field to change the search. | |
415 find_text_->RequestFocus(); | 417 find_text_->RequestFocus(); |
416 } | 418 } |
417 break; | 419 break; |
418 case CLOSE_TAG: | 420 case CLOSE_TAG: |
419 find_bar_host()->GetFindBarController()->EndFindSession( | 421 find_bar_host()->GetFindBarController()->EndFindSession( |
420 FindBarController::kKeepSelectionOnPage, | 422 FindBarController::kKeepSelectionOnPage, |
421 FindBarController::kKeepResultsInFindBox); | 423 FindBarController::kKeepResultsInFindBox); |
422 break; | 424 break; |
423 default: | 425 default: |
424 NOTREACHED() << L"Unknown button"; | 426 NOTREACHED() << L"Unknown button"; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
661 void FindBarView::OnNativeThemeChanged(const ui::NativeTheme* theme) { | 663 void FindBarView::OnNativeThemeChanged(const ui::NativeTheme* theme) { |
662 if (!ui::MaterialDesignController::IsModeMaterial()) | 664 if (!ui::MaterialDesignController::IsModeMaterial()) |
663 return; | 665 return; |
664 | 666 |
665 SkColor color = | 667 SkColor color = |
666 theme->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground); | 668 theme->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground); |
667 set_background(views::Background::CreateSolidBackground(color)); | 669 set_background(views::Background::CreateSolidBackground(color)); |
668 match_count_text_->SetBackgroundColor(color); | 670 match_count_text_->SetBackgroundColor(color); |
669 match_count_text_->SetEnabledColor(kMatchTextColorMD); | 671 match_count_text_->SetEnabledColor(kMatchTextColorMD); |
670 } | 672 } |
OLD | NEW |