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

Side by Side Diff: chrome/browser/guest_view/guest_view_base.cc

Issue 293043003: <webview>: Move PreHandleGestureEvent in chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT Created 6 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 "chrome/browser/guest_view/guest_view_base.h" 5 #include "chrome/browser/guest_view/guest_view_base.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "chrome/browser/guest_view/ad_view/ad_view_guest.h" 8 #include "chrome/browser/guest_view/ad_view/ad_view_guest.h"
9 #include "chrome/browser/guest_view/guest_view_constants.h" 9 #include "chrome/browser/guest_view/guest_view_constants.h"
10 #include "chrome/browser/guest_view/guest_view_manager.h" 10 #include "chrome/browser/guest_view/guest_view_manager.h"
11 #include "chrome/browser/guest_view/web_view/web_view_guest.h" 11 #include "chrome/browser/guest_view/web_view/web_view_guest.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/common/content_settings.h" 13 #include "chrome/common/content_settings.h"
14 #include "content/public/browser/render_process_host.h" 14 #include "content/public/browser/render_process_host.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "content/public/common/url_constants.h" 16 #include "content/public/common/url_constants.h"
17 #include "extensions/browser/event_router.h" 17 #include "extensions/browser/event_router.h"
18 #include "net/base/escape.h" 18 #include "net/base/escape.h"
19 #include "third_party/WebKit/public/web/WebInputEvent.h"
19 20
20 using content::WebContents; 21 using content::WebContents;
21 22
22 namespace { 23 namespace {
23 24
24 typedef std::map<WebContents*, GuestViewBase*> WebContentsGuestViewMap; 25 typedef std::map<WebContents*, GuestViewBase*> WebContentsGuestViewMap;
25 static base::LazyInstance<WebContentsGuestViewMap> webcontents_guestview_map = 26 static base::LazyInstance<WebContentsGuestViewMap> webcontents_guestview_map =
26 LAZY_INSTANCE_INITIALIZER; 27 LAZY_INSTANCE_INITIALIZER;
27 28
28 } // namespace 29 } // namespace
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 return; 183 return;
183 } 184 }
184 opener_ = base::WeakPtr<GuestViewBase>(); 185 opener_ = base::WeakPtr<GuestViewBase>();
185 } 186 }
186 187
187 void GuestViewBase::RegisterDestructionCallback( 188 void GuestViewBase::RegisterDestructionCallback(
188 const DestructionCallback& callback) { 189 const DestructionCallback& callback) {
189 destruction_callback_ = callback; 190 destruction_callback_ = callback;
190 } 191 }
191 192
193 bool GuestViewBase::PreHandleGestureEvent(content::WebContents* source,
194 const blink::WebGestureEvent& event) {
195 return event.type == blink::WebGestureEvent::GesturePinchBegin ||
196 event.type == blink::WebGestureEvent::GesturePinchUpdate ||
197 event.type == blink::WebGestureEvent::GesturePinchEnd;
198 }
199
192 GuestViewBase::~GuestViewBase() { 200 GuestViewBase::~GuestViewBase() {
193 std::pair<int, int> key(embedder_render_process_id_, guest_instance_id_); 201 std::pair<int, int> key(embedder_render_process_id_, guest_instance_id_);
194 202
195 webcontents_guestview_map.Get().erase(guest_web_contents()); 203 webcontents_guestview_map.Get().erase(guest_web_contents());
196 204
197 GuestViewManager::FromBrowserContext(browser_context_)-> 205 GuestViewManager::FromBrowserContext(browser_context_)->
198 RemoveGuest(guest_instance_id_); 206 RemoveGuest(guest_instance_id_);
199 207
200 pending_events_.clear(); 208 pending_events_.clear();
201 } 209 }
(...skipping 30 matching lines...) Expand all
232 240
233 void GuestViewBase::SendQueuedEvents() { 241 void GuestViewBase::SendQueuedEvents() {
234 if (!attached()) 242 if (!attached())
235 return; 243 return;
236 while (!pending_events_.empty()) { 244 while (!pending_events_.empty()) {
237 linked_ptr<Event> event_ptr = pending_events_.front(); 245 linked_ptr<Event> event_ptr = pending_events_.front();
238 pending_events_.pop_front(); 246 pending_events_.pop_front();
239 DispatchEvent(event_ptr.release()); 247 DispatchEvent(event_ptr.release());
240 } 248 }
241 } 249 }
OLDNEW
« no previous file with comments | « chrome/browser/guest_view/guest_view_base.h ('k') | content/browser/browser_plugin/browser_plugin_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698