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

Side by Side Diff: extensions/browser/app_window/app_web_contents_helper.cc

Issue 2861373004: Add blink::WebInputEvent::IsPinchGestureEventType(). (Closed)
Patch Set: rebase Created 3 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 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 "extensions/browser/app_window/app_web_contents_helper.h" 5 #include "extensions/browser/app_window/app_web_contents_helper.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "content/public/browser/native_web_keyboard_event.h" 8 #include "content/public/browser/native_web_keyboard_event.h"
9 #include "content/public/browser/page_navigator.h" 9 #include "content/public/browser/page_navigator.h"
10 #include "content/public/browser/render_frame_host.h" 10 #include "content/public/browser/render_frame_host.h"
(...skipping 15 matching lines...) Expand all
26 : browser_context_(browser_context), 26 : browser_context_(browser_context),
27 extension_id_(extension_id), 27 extension_id_(extension_id),
28 web_contents_(web_contents), 28 web_contents_(web_contents),
29 app_delegate_(app_delegate) { 29 app_delegate_(app_delegate) {
30 } 30 }
31 31
32 // static 32 // static
33 bool AppWebContentsHelper::ShouldSuppressGestureEvent( 33 bool AppWebContentsHelper::ShouldSuppressGestureEvent(
34 const blink::WebGestureEvent& event) { 34 const blink::WebGestureEvent& event) {
35 // Disable pinch zooming in app windows. 35 // Disable pinch zooming in app windows.
36 return event.GetType() == blink::WebGestureEvent::kGesturePinchBegin || 36 return blink::WebInputEvent::IsPinchGestureEventType(event.GetType());
37 event.GetType() == blink::WebGestureEvent::kGesturePinchUpdate ||
38 event.GetType() == blink::WebGestureEvent::kGesturePinchEnd;
39 } 37 }
40 38
41 content::WebContents* AppWebContentsHelper::OpenURLFromTab( 39 content::WebContents* AppWebContentsHelper::OpenURLFromTab(
42 const content::OpenURLParams& params) const { 40 const content::OpenURLParams& params) const {
43 // Don't allow the current tab to be navigated. It would be nice to map all 41 // Don't allow the current tab to be navigated. It would be nice to map all
44 // anchor tags (even those without target="_blank") to new tabs, but right 42 // anchor tags (even those without target="_blank") to new tabs, but right
45 // now we can't distinguish between those and <meta> refreshes or window.href 43 // now we can't distinguish between those and <meta> refreshes or window.href
46 // navigations, which we don't want to allow. 44 // navigations, which we don't want to allow.
47 // TOOD(mihaip): Can we check for user gestures instead? 45 // TOOD(mihaip): Can we check for user gestures instead?
48 WindowOpenDisposition disposition = params.disposition; 46 WindowOpenDisposition disposition = params.disposition;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 web_contents_, security_origin, type, extension); 104 web_contents_, security_origin, type, extension);
107 } 105 }
108 106
109 const Extension* AppWebContentsHelper::GetExtension() const { 107 const Extension* AppWebContentsHelper::GetExtension() const {
110 return ExtensionRegistry::Get(browser_context_) 108 return ExtensionRegistry::Get(browser_context_)
111 ->enabled_extensions() 109 ->enabled_extensions()
112 .GetByID(extension_id_); 110 .GetByID(extension_id_);
113 } 111 }
114 112
115 } // namespace extensions 113 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698