| OLD | NEW |
| 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_win.h" | 5 #include "chrome/browser/views/find_bar_win.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/find_bar_controller.h" | 9 #include "chrome/browser/find_bar_controller.h" |
| 10 #include "chrome/browser/renderer_host/render_view_host.h" | 10 #include "chrome/browser/renderer_host/render_view_host.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 return; | 225 return; |
| 226 } | 226 } |
| 227 | 227 |
| 228 gfx::Rect new_pos = GetDialogPosition(selection_rect); | 228 gfx::Rect new_pos = GetDialogPosition(selection_rect); |
| 229 SetDialogPosition(new_pos, no_redraw); | 229 SetDialogPosition(new_pos, no_redraw); |
| 230 | 230 |
| 231 // May need to redraw our frame to accommodate bookmark bar styles. | 231 // May need to redraw our frame to accommodate bookmark bar styles. |
| 232 view_->SchedulePaint(); | 232 view_->SchedulePaint(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 void FindBarWin::ForwardKeystrokeToWebpage(TCHAR key) { |
| 236 WebContents* contents = find_bar_controller_->web_contents(); |
| 237 if (!contents) |
| 238 return; |
| 239 |
| 240 RenderViewHost* render_view_host = contents->render_view_host(); |
| 241 |
| 242 // Make sure we don't have a text field element interfering with keyboard |
| 243 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". |
| 244 render_view_host->ClearFocusedNode(); |
| 245 |
| 246 HWND hwnd = contents->GetContentNativeView(); |
| 247 render_view_host->ForwardKeyboardEvent( |
| 248 NativeWebKeyboardEvent(hwnd, WM_KEYDOWN, key, 0)); |
| 249 render_view_host->ForwardKeyboardEvent( |
| 250 NativeWebKeyboardEvent(hwnd, WM_KEYUP, key, 0)); |
| 251 } |
| 252 |
| 235 //////////////////////////////////////////////////////////////////////////////// | 253 //////////////////////////////////////////////////////////////////////////////// |
| 236 // FindBarWin, views::WidgetWin implementation: | 254 // FindBarWin, views::WidgetWin implementation: |
| 237 | 255 |
| 238 void FindBarWin::OnFinalMessage(HWND window) { | 256 void FindBarWin::OnFinalMessage(HWND window) { |
| 239 // TODO(beng): Destroy the RootView before destroying the Focus Manager will | 257 // TODO(beng): Destroy the RootView before destroying the Focus Manager will |
| 240 // allow us to remove this method. | 258 // allow us to remove this method. |
| 241 | 259 |
| 242 // We are exiting, so we no longer need to monitor focus changes. | 260 // We are exiting, so we no longer need to monitor focus changes. |
| 243 focus_manager_->RemoveFocusChangeListener(this); | 261 focus_manager_->RemoveFocusChangeListener(this); |
| 244 | 262 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 523 |
| 506 // We now need to check if the window is obscuring the search results. | 524 // We now need to check if the window is obscuring the search results. |
| 507 if (!result.selection_rect().IsEmpty()) | 525 if (!result.selection_rect().IsEmpty()) |
| 508 MoveWindowIfNecessary(result.selection_rect(), false); | 526 MoveWindowIfNecessary(result.selection_rect(), false); |
| 509 | 527 |
| 510 // Once we find a match we no longer want to keep track of what had | 528 // Once we find a match we no longer want to keep track of what had |
| 511 // focus. EndFindSession will then set the focus to the page content. | 529 // focus. EndFindSession will then set the focus to the page content. |
| 512 if (result.number_of_matches() > 0) | 530 if (result.number_of_matches() > 0) |
| 513 focus_tracker_.reset(NULL); | 531 focus_tracker_.reset(NULL); |
| 514 } | 532 } |
| OLD | NEW |