| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 505 |
| 506 bool FindBarView::HandleKeyEvent(views::Textfield* sender, | 506 bool FindBarView::HandleKeyEvent(views::Textfield* sender, |
| 507 const views::KeyEvent& key_event) { | 507 const views::KeyEvent& key_event) { |
| 508 // If the dialog is not visible, there is no reason to process keyboard input. | 508 // If the dialog is not visible, there is no reason to process keyboard input. |
| 509 if (!host()->IsVisible()) | 509 if (!host()->IsVisible()) |
| 510 return false; | 510 return false; |
| 511 | 511 |
| 512 if (find_bar_host()->MaybeForwardKeyEventToWebpage(key_event)) | 512 if (find_bar_host()->MaybeForwardKeyEventToWebpage(key_event)) |
| 513 return true; // Handled, we are done! | 513 return true; // Handled, we are done! |
| 514 | 514 |
| 515 if (key_event.GetKeyCode() == app::VKEY_RETURN) { | 515 if (key_event.GetKeyCode() == ui::VKEY_RETURN) { |
| 516 // Pressing Return/Enter starts the search (unless text box is empty). | 516 // Pressing Return/Enter starts the search (unless text box is empty). |
| 517 string16 find_string = find_text_->text(); | 517 string16 find_string = find_text_->text(); |
| 518 if (!find_string.empty()) { | 518 if (!find_string.empty()) { |
| 519 // Search forwards for enter, backwards for shift-enter. | 519 // Search forwards for enter, backwards for shift-enter. |
| 520 find_bar_host()->GetFindBarController()->tab_contents()->StartFinding( | 520 find_bar_host()->GetFindBarController()->tab_contents()->StartFinding( |
| 521 find_string, | 521 find_string, |
| 522 !key_event.IsShiftDown(), | 522 !key_event.IsShiftDown(), |
| 523 false); // Not case sensitive. | 523 false); // Not case sensitive. |
| 524 } | 524 } |
| 525 } | 525 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 554 | 554 |
| 555 void FindBarView::OnThemeChanged() { | 555 void FindBarView::OnThemeChanged() { |
| 556 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 556 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 557 if (GetThemeProvider()) { | 557 if (GetThemeProvider()) { |
| 558 close_button_->SetBackground( | 558 close_button_->SetBackground( |
| 559 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TAB_TEXT), | 559 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TAB_TEXT), |
| 560 rb.GetBitmapNamed(IDR_CLOSE_BAR), | 560 rb.GetBitmapNamed(IDR_CLOSE_BAR), |
| 561 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); | 561 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); |
| 562 } | 562 } |
| 563 } | 563 } |
| OLD | NEW |