Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2023)

Side by Side Diff: chrome/browser/views/find_bar_view.cc

Issue 62129: Find should allow keyboard scrolling while Find bar has focus (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/find_bar_view.h ('k') | chrome/browser/views/find_bar_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/views/find_bar_view.h" 5 #include "chrome/browser/views/find_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/find_bar_controller.h" 10 #include "chrome/browser/find_bar_controller.h"
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 // initiate search (even though old searches might be in progress). 466 // initiate search (even though old searches might be in progress).
467 if (new_contents.length() > 0) { 467 if (new_contents.length() > 0) {
468 controller->web_contents()->StartFinding(new_contents, true); 468 controller->web_contents()->StartFinding(new_contents, true);
469 } else { 469 } else {
470 // The textbox is empty so we reset. true = clear selection on page. 470 // The textbox is empty so we reset. true = clear selection on page.
471 controller->web_contents()->StopFinding(true); 471 controller->web_contents()->StopFinding(true);
472 UpdateForResult(controller->web_contents()->find_result(), std::wstring()); 472 UpdateForResult(controller->web_contents()->find_result(), std::wstring());
473 } 473 }
474 } 474 }
475 475
476 void FindBarView::HandleKeystroke(views::TextField* sender, UINT message, 476 bool FindBarView::HandleKeystroke(views::TextField* sender, UINT message,
477 TCHAR key, UINT repeat_count, UINT flags) { 477 TCHAR key, UINT repeat_count, UINT flags) {
478 // If the dialog is not visible, there is no reason to process keyboard input. 478 // If the dialog is not visible, there is no reason to process keyboard input.
479 if (!container_->IsVisible()) 479 if (!container_->IsVisible())
480 return; 480 return false;
481 481
482 switch (key) { 482 switch (key) {
483 case VK_RETURN: { 483 case VK_RETURN: {
484 // Pressing Return/Enter starts the search (unless text box is empty). 484 // Pressing Return/Enter starts the search (unless text box is empty).
485 std::wstring find_string = find_text_->GetText(); 485 std::wstring find_string = find_text_->GetText();
486 if (find_string.length() > 0) { 486 if (find_string.length() > 0) {
487 // Search forwards for enter, backwards for shift-enter. 487 // Search forwards for enter, backwards for shift-enter.
488 container_->GetFindBarController()->web_contents()->StartFinding( 488 container_->GetFindBarController()->web_contents()->StartFinding(
489 find_string, 489 find_string,
490 GetKeyState(VK_SHIFT) >= 0); 490 GetKeyState(VK_SHIFT) >= 0);
491 } 491 }
492 break; 492 break;
493 } 493 }
494 #if defined(OS_WIN)
495 // TODO(port): Handle this for other platforms.
496 case VK_UP:
497 case VK_DOWN:
498 case VK_PRIOR: // Page up
499 case VK_NEXT: // Page down
500 container_->ForwardKeystrokeToWebpage(key);
501 return true; // Message has been handled. No further processing needed.
502 #endif
494 } 503 }
504
505 return false;
495 } 506 }
496 507
497 void FindBarView::ResetMatchCountBackground() { 508 void FindBarView::ResetMatchCountBackground() {
498 match_count_text_->set_background( 509 match_count_text_->set_background(
499 views::Background::CreateSolidBackground(kBackgroundColorMatch)); 510 views::Background::CreateSolidBackground(kBackgroundColorMatch));
500 match_count_text_->SetColor(kTextColorMatchCount); 511 match_count_text_->SetColor(kTextColorMatchCount);
501 } 512 }
502 513
503 bool FindBarView::FocusForwarderView::OnMousePressed( 514 bool FindBarView::FocusForwarderView::OnMousePressed(
504 const views::MouseEvent& event) { 515 const views::MouseEvent& event) {
505 if (view_to_focus_on_mousedown_) { 516 if (view_to_focus_on_mousedown_) {
506 view_to_focus_on_mousedown_->ClearSelection(); 517 view_to_focus_on_mousedown_->ClearSelection();
507 view_to_focus_on_mousedown_->RequestFocus(); 518 view_to_focus_on_mousedown_->RequestFocus();
508 } 519 }
509 return true; 520 return true;
510 } 521 }
OLDNEW
« no previous file with comments | « chrome/browser/views/find_bar_view.h ('k') | chrome/browser/views/find_bar_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698