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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/location_bar/location_bar_bubble_delegate_view .h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view .h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
(...skipping 12 matching lines...) Expand all
23 event_monitor_ = views::EventMonitor::CreateWindowMonitor( 23 event_monitor_ = views::EventMonitor::CreateWindowMonitor(
24 this, web_contents_->GetTopLevelNativeWindow()); 24 this, web_contents_->GetTopLevelNativeWindow());
25 } 25 }
26 26
27 LocationBarBubbleDelegateView::WebContentMouseHandler:: 27 LocationBarBubbleDelegateView::WebContentMouseHandler::
28 ~WebContentMouseHandler() {} 28 ~WebContentMouseHandler() {}
29 29
30 void LocationBarBubbleDelegateView::WebContentMouseHandler::OnKeyEvent( 30 void LocationBarBubbleDelegateView::WebContentMouseHandler::OnKeyEvent(
31 ui::KeyEvent* event) { 31 ui::KeyEvent* event) {
32 if ((event->key_code() == ui::VKEY_ESCAPE || 32 if ((event->key_code() == ui::VKEY_ESCAPE ||
33 web_contents_->GetRenderViewHost()->IsFocusedElementEditable()) && 33 web_contents_->IsFocusedElementEditable()) &&
34 event->type() == ui::ET_KEY_PRESSED) 34 event->type() == ui::ET_KEY_PRESSED)
35 bubble_->CloseBubble(); 35 bubble_->CloseBubble();
36 } 36 }
37 37
38 void LocationBarBubbleDelegateView::WebContentMouseHandler::OnMouseEvent( 38 void LocationBarBubbleDelegateView::WebContentMouseHandler::OnMouseEvent(
39 ui::MouseEvent* event) { 39 ui::MouseEvent* event) {
40 if (event->type() == ui::ET_MOUSE_PRESSED) 40 if (event->type() == ui::ET_MOUSE_PRESSED)
41 bubble_->CloseBubble(); 41 bubble_->CloseBubble();
42 } 42 }
43 43
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 if (GetAnchorView()) 103 if (GetAnchorView())
104 return; 104 return;
105 105
106 const int kBubblePaddingFromScreenEdge = 20; 106 const int kBubblePaddingFromScreenEdge = 20;
107 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge; 107 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge;
108 const int x_pos = base::i18n::IsRTL() 108 const int x_pos = base::i18n::IsRTL()
109 ? (screen_bounds.x() + horizontal_offset) 109 ? (screen_bounds.x() + horizontal_offset)
110 : (screen_bounds.right() - horizontal_offset); 110 : (screen_bounds.right() - horizontal_offset);
111 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); 111 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0));
112 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698