OLD | NEW |
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/tab_contents/chrome_web_contents_view_delegate_views.h" | 5 #include "chrome/browser/tab_contents/chrome_web_contents_view_delegate_views.h" |
6 | 6 |
7 #include "chrome/browser/browser_shutdown.h" | 7 #include "chrome/browser/browser_shutdown.h" |
8 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 8 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
9 #include "chrome/browser/ui/sad_tab_helper.h" | 9 #include "chrome/browser/ui/sad_tab_helper.h" |
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 context_menu_.reset(new RenderViewContextMenuViews(web_contents_, params)); | 126 context_menu_.reset(new RenderViewContextMenuViews(web_contents_, params)); |
127 context_menu_->Init(); | 127 context_menu_->Init(); |
128 | 128 |
129 // Don't show empty menus. | 129 // Don't show empty menus. |
130 if (context_menu_->menu_model().GetItemCount() == 0) | 130 if (context_menu_->menu_model().GetItemCount() == 0) |
131 return; | 131 return; |
132 | 132 |
133 gfx::Point screen_point(params.x, params.y); | 133 gfx::Point screen_point(params.x, params.y); |
134 | 134 |
135 #if defined(USE_AURA) | 135 #if defined(USE_AURA) |
136 gfx::Point view_origin = | 136 gfx::Point view_origin = web_contents_->GetView()->GetNativeView()-> |
137 web_contents_->GetView()->GetNativeView()->GetScreenBounds().origin(); | 137 GetBoundsInRootWindow().origin(); |
138 screen_point.Offset(view_origin.x(), view_origin.y()); | 138 screen_point.Offset(view_origin.x(), view_origin.y()); |
139 #else | 139 #else |
140 POINT temp = screen_point.ToPOINT(); | 140 POINT temp = screen_point.ToPOINT(); |
141 ClientToScreen(web_contents_->GetView()->GetNativeView(), &temp); | 141 ClientToScreen(web_contents_->GetView()->GetNativeView(), &temp); |
142 screen_point = temp; | 142 screen_point = temp; |
143 #endif | 143 #endif |
144 | 144 |
145 // Enable recursive tasks on the message loop so we can get updates while | 145 // Enable recursive tasks on the message loop so we can get updates while |
146 // the context menu is being displayed. | 146 // the context menu is being displayed. |
147 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 147 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
(...skipping 24 matching lines...) Expand all Loading... |
172 return toplevel_widget ? toplevel_widget->GetFocusManager() : NULL; | 172 return toplevel_widget ? toplevel_widget->GetFocusManager() : NULL; |
173 } | 173 } |
174 | 174 |
175 void ChromeWebContentsViewDelegateViews::SetInitialFocus() { | 175 void ChromeWebContentsViewDelegateViews::SetInitialFocus() { |
176 if (web_contents_->FocusLocationBarByDefault()) { | 176 if (web_contents_->FocusLocationBarByDefault()) { |
177 web_contents_->SetFocusToLocationBar(false); | 177 web_contents_->SetFocusToLocationBar(false); |
178 } else { | 178 } else { |
179 web_contents_->GetView()->Focus(); | 179 web_contents_->GetView()->Focus(); |
180 } | 180 } |
181 } | 181 } |
OLD | NEW |