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_host.h" | 5 #include "chrome/browser/ui/views/find_bar_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
10 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 10 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
12 #include "chrome/browser/ui/view_ids.h" | 12 #include "chrome/browser/ui/view_ids.h" |
13 #include "chrome/browser/ui/views/find_bar_view.h" | 13 #include "chrome/browser/ui/views/find_bar_view.h" |
14 #include "chrome/browser/ui/views/frame/browser_view.h" | 14 #include "chrome/browser/ui/views/frame/browser_view.h" |
15 #include "content/browser/renderer_host/render_view_host.h" | 15 #include "content/browser/renderer_host/render_view_host.h" |
16 #include "content/browser/tab_contents/tab_contents.h" | 16 #include "content/browser/tab_contents/tab_contents.h" |
17 #include "content/browser/tab_contents/tab_contents_view.h" | 17 #include "content/browser/tab_contents/tab_contents_view.h" |
18 #include "content/common/view_messages.h" | |
19 #include "ui/base/keycodes/keyboard_codes.h" | 18 #include "ui/base/keycodes/keyboard_codes.h" |
20 #include "views/focus/external_focus_tracker.h" | 19 #include "views/focus/external_focus_tracker.h" |
21 #include "views/focus/view_storage.h" | 20 #include "views/focus/view_storage.h" |
22 #include "views/widget/root_view.h" | 21 #include "views/widget/root_view.h" |
23 #include "views/widget/widget.h" | 22 #include "views/widget/widget.h" |
24 | 23 |
25 namespace browser { | 24 namespace browser { |
26 | 25 |
27 // Declared in browser_dialogs.h so others don't have to depend on our header. | 26 // Declared in browser_dialogs.h so others don't have to depend on our header. |
28 FindBar* CreateFindBar(BrowserView* browser_view) { | 27 FindBar* CreateFindBar(BrowserView* browser_view) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 66 } |
68 | 67 |
69 TabContentsWrapper* contents = find_bar_controller_->tab_contents(); | 68 TabContentsWrapper* contents = find_bar_controller_->tab_contents(); |
70 if (!contents) | 69 if (!contents) |
71 return false; | 70 return false; |
72 | 71 |
73 RenderViewHost* render_view_host = contents->render_view_host(); | 72 RenderViewHost* render_view_host = contents->render_view_host(); |
74 | 73 |
75 // Make sure we don't have a text field element interfering with keyboard | 74 // Make sure we don't have a text field element interfering with keyboard |
76 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". | 75 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". |
77 render_view_host->Send( | 76 render_view_host->ClearFocusedNode(); |
78 new ViewMsg_ClearFocusedNode(render_view_host->routing_id())); | |
79 NativeWebKeyboardEvent event = GetKeyboardEvent(contents->tab_contents(), | 77 NativeWebKeyboardEvent event = GetKeyboardEvent(contents->tab_contents(), |
80 key_event); | 78 key_event); |
81 render_view_host->ForwardKeyboardEvent(event); | 79 render_view_host->ForwardKeyboardEvent(event); |
82 return true; | 80 return true; |
83 } | 81 } |
84 | 82 |
85 FindBarController* FindBarHost::GetFindBarController() const { | 83 FindBarController* FindBarHost::GetFindBarController() const { |
86 return find_bar_controller_; | 84 return find_bar_controller_; |
87 } | 85 } |
88 | 86 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 313 |
316 DropdownBarHost::UnregisterAccelerators(); | 314 DropdownBarHost::UnregisterAccelerators(); |
317 } | 315 } |
318 | 316 |
319 //////////////////////////////////////////////////////////////////////////////// | 317 //////////////////////////////////////////////////////////////////////////////// |
320 // private: | 318 // private: |
321 | 319 |
322 FindBarView* FindBarHost::find_bar_view() { | 320 FindBarView* FindBarHost::find_bar_view() { |
323 return static_cast<FindBarView*>(view()); | 321 return static_cast<FindBarView*>(view()); |
324 } | 322 } |
OLD | NEW |