| OLD | NEW |
| 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 Loading... |
| 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.type == blink::WebGestureEvent::GesturePinchBegin || | 36 return event.type() == blink::WebGestureEvent::GesturePinchBegin || |
| 37 event.type == blink::WebGestureEvent::GesturePinchUpdate || | 37 event.type() == blink::WebGestureEvent::GesturePinchUpdate || |
| 38 event.type == blink::WebGestureEvent::GesturePinchEnd; | 38 event.type() == blink::WebGestureEvent::GesturePinchEnd; |
| 39 } | 39 } |
| 40 | 40 |
| 41 content::WebContents* AppWebContentsHelper::OpenURLFromTab( | 41 content::WebContents* AppWebContentsHelper::OpenURLFromTab( |
| 42 const content::OpenURLParams& params) const { | 42 const content::OpenURLParams& params) const { |
| 43 // Don't allow the current tab to be navigated. It would be nice to map all | 43 // 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 | 44 // 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 | 45 // now we can't distinguish between those and <meta> refreshes or window.href |
| 46 // navigations, which we don't want to allow. | 46 // navigations, which we don't want to allow. |
| 47 // TOOD(mihaip): Can we check for user gestures instead? | 47 // TOOD(mihaip): Can we check for user gestures instead? |
| 48 WindowOpenDisposition disposition = params.disposition; | 48 WindowOpenDisposition disposition = params.disposition; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 web_contents_, security_origin, type, extension); | 106 web_contents_, security_origin, type, extension); |
| 107 } | 107 } |
| 108 | 108 |
| 109 const Extension* AppWebContentsHelper::GetExtension() const { | 109 const Extension* AppWebContentsHelper::GetExtension() const { |
| 110 return ExtensionRegistry::Get(browser_context_) | 110 return ExtensionRegistry::Get(browser_context_) |
| 111 ->enabled_extensions() | 111 ->enabled_extensions() |
| 112 .GetByID(extension_id_); | 112 .GetByID(extension_id_); |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace extensions | 115 } // namespace extensions |
| OLD | NEW |