OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 // we close and reopen the Find box it doesn't show the search we just | 493 // we close and reopen the Find box it doesn't show the search we just |
494 // deleted. We can't do this on ChromeOS yet because we get ContentsChanged | 494 // deleted. We can't do this on ChromeOS yet because we get ContentsChanged |
495 // sent for a lot more things than just the user nulling out the search | 495 // sent for a lot more things than just the user nulling out the search |
496 // terms. See http://crbug.com/45372. | 496 // terms. See http://crbug.com/45372. |
497 FindBarState* find_bar_state = | 497 FindBarState* find_bar_state = |
498 controller->tab_contents()->profile()->GetFindBarState(); | 498 controller->tab_contents()->profile()->GetFindBarState(); |
499 find_bar_state->set_last_prepopulate_text(string16()); | 499 find_bar_state->set_last_prepopulate_text(string16()); |
500 } | 500 } |
501 } | 501 } |
502 | 502 |
503 bool FindBarView::HandleKeystroke(views::Textfield* sender, | 503 bool FindBarView::HandleKeyEvent(views::Textfield* sender, |
504 const views::Textfield::Keystroke& key) { | 504 const views::KeyEvent& key_event) { |
505 // If the dialog is not visible, there is no reason to process keyboard input. | 505 // If the dialog is not visible, there is no reason to process keyboard input. |
506 if (!host()->IsVisible()) | 506 if (!host()->IsVisible()) |
507 return false; | 507 return false; |
508 | 508 |
509 if (find_bar_host()->MaybeForwardKeystrokeToWebpage(key)) | 509 if (find_bar_host()->MaybeForwardKeyEventToWebpage(key_event)) |
510 return true; // Handled, we are done! | 510 return true; // Handled, we are done! |
511 | 511 |
512 if (key.GetKeyboardCode() == app::VKEY_RETURN) { | 512 if (key_event.GetKeyCode() == app::VKEY_RETURN) { |
513 // Pressing Return/Enter starts the search (unless text box is empty). | 513 // Pressing Return/Enter starts the search (unless text box is empty). |
514 string16 find_string = find_text_->text(); | 514 string16 find_string = find_text_->text(); |
515 if (!find_string.empty()) { | 515 if (!find_string.empty()) { |
516 // Search forwards for enter, backwards for shift-enter. | 516 // Search forwards for enter, backwards for shift-enter. |
517 find_bar_host()->GetFindBarController()->tab_contents()->StartFinding( | 517 find_bar_host()->GetFindBarController()->tab_contents()->StartFinding( |
518 find_string, | 518 find_string, |
519 !key.IsShiftHeld(), | 519 !key_event.IsShiftDown(), |
520 false); // Not case sensitive. | 520 false); // Not case sensitive. |
521 } | 521 } |
522 } | 522 } |
523 | 523 |
524 return false; | 524 return false; |
525 } | 525 } |
526 | 526 |
527 void FindBarView::UpdateMatchCountAppearance(bool no_match) { | 527 void FindBarView::UpdateMatchCountAppearance(bool no_match) { |
528 if (no_match) { | 528 if (no_match) { |
529 match_count_text_->set_background( | 529 match_count_text_->set_background( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 562 |
563 void FindBarView::OnThemeChanged() { | 563 void FindBarView::OnThemeChanged() { |
564 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 564 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
565 if (GetThemeProvider()) { | 565 if (GetThemeProvider()) { |
566 close_button_->SetBackground( | 566 close_button_->SetBackground( |
567 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TAB_TEXT), | 567 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TAB_TEXT), |
568 rb.GetBitmapNamed(IDR_CLOSE_BAR), | 568 rb.GetBitmapNamed(IDR_CLOSE_BAR), |
569 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); | 569 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); |
570 } | 570 } |
571 } | 571 } |
OLD | NEW |