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 "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" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 WebContents* guest_web_contents, | 44 WebContents* guest_web_contents, |
45 const std::string& embedder_extension_id) | 45 const std::string& embedder_extension_id) |
46 : guest_web_contents_(guest_web_contents), | 46 : guest_web_contents_(guest_web_contents), |
47 embedder_web_contents_(NULL), | 47 embedder_web_contents_(NULL), |
48 embedder_extension_id_(embedder_extension_id), | 48 embedder_extension_id_(embedder_extension_id), |
49 embedder_render_process_id_(0), | 49 embedder_render_process_id_(0), |
50 browser_context_(guest_web_contents->GetBrowserContext()), | 50 browser_context_(guest_web_contents->GetBrowserContext()), |
51 guest_instance_id_(guest_instance_id), | 51 guest_instance_id_(guest_instance_id), |
52 view_instance_id_(guestview::kInstanceIDNone), | 52 view_instance_id_(guestview::kInstanceIDNone), |
53 weak_ptr_factory_(this) { | 53 weak_ptr_factory_(this) { |
| 54 guest_web_contents->SetDelegate(this); |
54 webcontents_guestview_map.Get().insert( | 55 webcontents_guestview_map.Get().insert( |
55 std::make_pair(guest_web_contents, this)); | 56 std::make_pair(guest_web_contents, this)); |
56 GuestViewManager::FromBrowserContext(browser_context_)-> | 57 GuestViewManager::FromBrowserContext(browser_context_)-> |
57 AddGuest(guest_instance_id_, guest_web_contents); | 58 AddGuest(guest_instance_id_, guest_web_contents); |
58 } | 59 } |
59 | 60 |
60 // static | 61 // static |
61 GuestViewBase* GuestViewBase::Create( | 62 GuestViewBase* GuestViewBase::Create( |
62 int guest_instance_id, | 63 int guest_instance_id, |
63 WebContents* guest_web_contents, | 64 WebContents* guest_web_contents, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 return; | 184 return; |
184 } | 185 } |
185 opener_ = base::WeakPtr<GuestViewBase>(); | 186 opener_ = base::WeakPtr<GuestViewBase>(); |
186 } | 187 } |
187 | 188 |
188 void GuestViewBase::RegisterDestructionCallback( | 189 void GuestViewBase::RegisterDestructionCallback( |
189 const DestructionCallback& callback) { | 190 const DestructionCallback& callback) { |
190 destruction_callback_ = callback; | 191 destruction_callback_ = callback; |
191 } | 192 } |
192 | 193 |
| 194 bool GuestViewBase::ShouldFocusPageAfterCrash() { |
| 195 // Focus is managed elsewhere. |
| 196 return false; |
| 197 } |
| 198 |
193 bool GuestViewBase::PreHandleGestureEvent(content::WebContents* source, | 199 bool GuestViewBase::PreHandleGestureEvent(content::WebContents* source, |
194 const blink::WebGestureEvent& event) { | 200 const blink::WebGestureEvent& event) { |
195 return event.type == blink::WebGestureEvent::GesturePinchBegin || | 201 return event.type == blink::WebGestureEvent::GesturePinchBegin || |
196 event.type == blink::WebGestureEvent::GesturePinchUpdate || | 202 event.type == blink::WebGestureEvent::GesturePinchUpdate || |
197 event.type == blink::WebGestureEvent::GesturePinchEnd; | 203 event.type == blink::WebGestureEvent::GesturePinchEnd; |
198 } | 204 } |
199 | 205 |
200 GuestViewBase::~GuestViewBase() { | 206 GuestViewBase::~GuestViewBase() { |
201 std::pair<int, int> key(embedder_render_process_id_, guest_instance_id_); | 207 std::pair<int, int> key(embedder_render_process_id_, guest_instance_id_); |
202 | 208 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 246 |
241 void GuestViewBase::SendQueuedEvents() { | 247 void GuestViewBase::SendQueuedEvents() { |
242 if (!attached()) | 248 if (!attached()) |
243 return; | 249 return; |
244 while (!pending_events_.empty()) { | 250 while (!pending_events_.empty()) { |
245 linked_ptr<Event> event_ptr = pending_events_.front(); | 251 linked_ptr<Event> event_ptr = pending_events_.front(); |
246 pending_events_.pop_front(); | 252 pending_events_.pop_front(); |
247 DispatchEvent(event_ptr.release()); | 253 DispatchEvent(event_ptr.release()); |
248 } | 254 } |
249 } | 255 } |
OLD | NEW |