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

Side by Side Diff: chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc

Issue 1926173002: Erase LinkDisambiguation code on desktop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another merge conflict Created 4 years, 7 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/tab_contents/chrome_web_contents_view_delegate _views.h" 5 #include "chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate _views.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "chrome/browser/defaults.h" 9 #include "chrome/browser/defaults.h"
10 #include "chrome/browser/ui/aura/tab_contents/web_drag_bookmark_handler_aura.h" 10 #include "chrome/browser/ui/aura/tab_contents/web_drag_bookmark_handler_aura.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_finder.h" 12 #include "chrome/browser/ui/browser_finder.h"
13 #include "chrome/browser/ui/browser_window.h" 13 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/browser/ui/sad_tab_helper.h" 14 #include "chrome/browser/ui/sad_tab_helper.h"
15 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" 15 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h"
16 #include "chrome/browser/ui/views/renderer_context_menu/render_view_context_menu _views.h" 16 #include "chrome/browser/ui/views/renderer_context_menu/render_view_context_menu _views.h"
17 #include "chrome/browser/ui/views/sad_tab_view.h" 17 #include "chrome/browser/ui/views/sad_tab_view.h"
18 #include "components/web_modal/web_contents_modal_dialog_manager.h" 18 #include "components/web_modal/web_contents_modal_dialog_manager.h"
19 #include "content/public/browser/render_widget_host_view.h" 19 #include "content/public/browser/render_widget_host_view.h"
20 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
21 #include "content/public/browser/web_contents_delegate.h" 21 #include "content/public/browser/web_contents_delegate.h"
22 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
23 #include "ui/views/focus/focus_manager.h" 23 #include "ui/views/focus/focus_manager.h"
24 #include "ui/views/focus/view_storage.h" 24 #include "ui/views/focus/view_storage.h"
25 #include "ui/views/widget/widget.h" 25 #include "ui/views/widget/widget.h"
26 26
27 #if defined(USE_AURA)
28 #include "chrome/browser/ui/views/link_disambiguation/link_disambiguation_popup. h"
29 #endif
30
31 ChromeWebContentsViewDelegateViews::ChromeWebContentsViewDelegateViews( 27 ChromeWebContentsViewDelegateViews::ChromeWebContentsViewDelegateViews(
32 content::WebContents* web_contents) 28 content::WebContents* web_contents)
33 : ContextMenuDelegate(web_contents), 29 : ContextMenuDelegate(web_contents),
34 web_contents_(web_contents) { 30 web_contents_(web_contents) {
35 last_focused_view_storage_id_ = 31 last_focused_view_storage_id_ =
36 views::ViewStorage::GetInstance()->CreateStorageID(); 32 views::ViewStorage::GetInstance()->CreateStorageID();
37 } 33 }
38 34
39 ChromeWebContentsViewDelegateViews::~ChromeWebContentsViewDelegateViews() { 35 ChromeWebContentsViewDelegateViews::~ChromeWebContentsViewDelegateViews() {
40 // Makes sure to remove any stored view we may still have in the ViewStorage. 36 // Makes sure to remove any stored view we may still have in the ViewStorage.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 142 }
147 143
148 void ChromeWebContentsViewDelegateViews::ShowContextMenu( 144 void ChromeWebContentsViewDelegateViews::ShowContextMenu(
149 content::RenderFrameHost* render_frame_host, 145 content::RenderFrameHost* render_frame_host,
150 const content::ContextMenuParams& params) { 146 const content::ContextMenuParams& params) {
151 ShowMenu( 147 ShowMenu(
152 BuildMenu(content::WebContents::FromRenderFrameHost(render_frame_host), 148 BuildMenu(content::WebContents::FromRenderFrameHost(render_frame_host),
153 params)); 149 params));
154 } 150 }
155 151
156 void ChromeWebContentsViewDelegateViews::ShowDisambiguationPopup(
157 const gfx::Rect& target_rect,
158 const SkBitmap& zoomed_bitmap,
159 const gfx::NativeView content,
160 const base::Callback<void(ui::GestureEvent*)>& gesture_cb,
161 const base::Callback<void(ui::MouseEvent*)>& mouse_cb) {
162 #if defined(USE_AURA)
163 // If we are attempting to show a link disambiguation popup while already
164 // showing one this means that the popup itself received an ambiguous touch.
165 // Don't show another popup in this case.
166 if (link_disambiguation_popup_) {
167 link_disambiguation_popup_.reset();
168 return;
169 }
170
171 link_disambiguation_popup_.reset(new LinkDisambiguationPopup);
172 link_disambiguation_popup_->Show(
173 views::Widget::GetTopLevelWidgetForNativeView(GetActiveNativeView()),
174 zoomed_bitmap,
175 target_rect,
176 content,
177 gesture_cb,
178 mouse_cb);
179 #endif
180 }
181
182 void ChromeWebContentsViewDelegateViews::HideDisambiguationPopup() {
183 link_disambiguation_popup_.reset();
184 }
185
186 void ChromeWebContentsViewDelegateViews::SizeChanged(const gfx::Size& size) { 152 void ChromeWebContentsViewDelegateViews::SizeChanged(const gfx::Size& size) {
187 SadTabHelper* sad_tab_helper = SadTabHelper::FromWebContents(web_contents_); 153 SadTabHelper* sad_tab_helper = SadTabHelper::FromWebContents(web_contents_);
188 if (!sad_tab_helper) 154 if (!sad_tab_helper)
189 return; 155 return;
190 SadTabView* sad_tab = static_cast<SadTabView*>(sad_tab_helper->sad_tab()); 156 SadTabView* sad_tab = static_cast<SadTabView*>(sad_tab_helper->sad_tab());
191 if (sad_tab) 157 if (sad_tab)
192 sad_tab->GetWidget()->SetBounds(gfx::Rect(size)); 158 sad_tab->GetWidget()->SetBounds(gfx::Rect(size));
193 } 159 }
194 160
195 aura::Window* ChromeWebContentsViewDelegateViews::GetActiveNativeView() { 161 aura::Window* ChromeWebContentsViewDelegateViews::GetActiveNativeView() {
(...skipping 22 matching lines...) Expand all
218 } 184 }
219 185
220 namespace chrome { 186 namespace chrome {
221 187
222 content::WebContentsViewDelegate* CreateWebContentsViewDelegate( 188 content::WebContentsViewDelegate* CreateWebContentsViewDelegate(
223 content::WebContents* web_contents) { 189 content::WebContents* web_contents) {
224 return new ChromeWebContentsViewDelegateViews(web_contents); 190 return new ChromeWebContentsViewDelegateViews(web_contents);
225 } 191 }
226 192
227 } // namespace chrome 193 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698