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

Side by Side Diff: chrome/browser/ui/views/find_bar_host.cc

Issue 2641403002: [refactor] - Move IsFocusedElementEditable() and ClearFocusedElement() from RenderViewHost to WebCo… (Closed)
Patch Set: Addressed sky@'s comment Created 3 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 10 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 break; 51 break;
52 // Fall through. 52 // Fall through.
53 default: 53 default:
54 return false; 54 return false;
55 } 55 }
56 56
57 content::WebContents* contents = find_bar_controller_->web_contents(); 57 content::WebContents* contents = find_bar_controller_->web_contents();
58 if (!contents) 58 if (!contents)
59 return false; 59 return false;
60 60
61 content::RenderViewHost* render_view_host = contents->GetRenderViewHost();
62
63 // Make sure we don't have a text field element interfering with keyboard 61 // Make sure we don't have a text field element interfering with keyboard
64 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". 62 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom".
65 render_view_host->ClearFocusedElement(); 63 contents->ClearFocusedElement();
66 NativeWebKeyboardEvent event(key_event); 64 NativeWebKeyboardEvent event(key_event);
67 render_view_host->GetWidget()->ForwardKeyboardEvent(event); 65 contents->GetRenderViewHost()->GetWidget()->ForwardKeyboardEvent(event);
68 return true; 66 return true;
69 } 67 }
70 68
71 FindBarController* FindBarHost::GetFindBarController() const { 69 FindBarController* FindBarHost::GetFindBarController() const {
72 return find_bar_controller_; 70 return find_bar_controller_;
73 } 71 }
74 72
75 void FindBarHost::SetFindBarController(FindBarController* find_bar_controller) { 73 void FindBarHost::SetFindBarController(FindBarController* find_bar_controller) {
76 find_bar_controller_ = find_bar_controller; 74 find_bar_controller_ = find_bar_controller;
77 } 75 }
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 341
344 //////////////////////////////////////////////////////////////////////////////// 342 ////////////////////////////////////////////////////////////////////////////////
345 // private: 343 // private:
346 344
347 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { 345 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) {
348 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); 346 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen();
349 gfx::Rect webcontents_rect = 347 gfx::Rect webcontents_rect =
350 find_bar_controller_->web_contents()->GetViewBounds(); 348 find_bar_controller_->web_contents()->GetViewBounds();
351 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); 349 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y());
352 } 350 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698