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 "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/guest_view/app_view/app_view_guest.h" | 9 #include "chrome/browser/guest_view/app_view/app_view_guest.h" |
10 #include "chrome/browser/guest_view/extension_options/extension_options_guest.h" | 10 #include "chrome/browser/guest_view/extension_options/extension_options_guest.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 | 99 |
100 void GuestViewBase::Init( | 100 void GuestViewBase::Init( |
101 const std::string& embedder_extension_id, | 101 const std::string& embedder_extension_id, |
102 int embedder_render_process_id, | 102 int embedder_render_process_id, |
103 const base::DictionaryValue& create_params, | 103 const base::DictionaryValue& create_params, |
104 const WebContentsCreatedCallback& callback) { | 104 const WebContentsCreatedCallback& callback) { |
105 if (initialized_) | 105 if (initialized_) |
106 return; | 106 return; |
107 initialized_ = true; | 107 initialized_ = true; |
108 | 108 |
109 if (!CanEmbedderUseGuestView(embedder_extension_id)) { | 109 if (!embedder_extension_id.empty()) { |
not at google - send to devlin
2014/08/07 23:06:02
this should also be unnecessary
ericzeng
2014/08/08 00:23:46
I'll leave it in until your patch lands.
not at google - send to devlin
2014/08/08 14:08:15
stay tuned!
| |
110 callback.Run(NULL); | 110 if (!CanEmbedderUseGuestView(embedder_extension_id)) { |
111 return; | 111 callback.Run(NULL); |
112 return; | |
113 } | |
112 } | 114 } |
113 | 115 |
114 CreateWebContents(embedder_extension_id, | 116 CreateWebContents(embedder_extension_id, |
115 embedder_render_process_id, | 117 embedder_render_process_id, |
116 create_params, | 118 create_params, |
117 base::Bind(&GuestViewBase::CompleteInit, | 119 base::Bind(&GuestViewBase::CompleteInit, |
118 AsWeakPtr(), | 120 AsWeakPtr(), |
119 embedder_extension_id, | 121 embedder_extension_id, |
120 embedder_render_process_id, | 122 embedder_render_process_id, |
121 callback)); | 123 callback)); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
382 return event.type == blink::WebGestureEvent::GesturePinchBegin || | 384 return event.type == blink::WebGestureEvent::GesturePinchBegin || |
383 event.type == blink::WebGestureEvent::GesturePinchUpdate || | 385 event.type == blink::WebGestureEvent::GesturePinchUpdate || |
384 event.type == blink::WebGestureEvent::GesturePinchEnd; | 386 event.type == blink::WebGestureEvent::GesturePinchEnd; |
385 } | 387 } |
386 | 388 |
387 GuestViewBase::~GuestViewBase() { | 389 GuestViewBase::~GuestViewBase() { |
388 } | 390 } |
389 | 391 |
390 void GuestViewBase::DispatchEventToEmbedder(Event* event) { | 392 void GuestViewBase::DispatchEventToEmbedder(Event* event) { |
391 scoped_ptr<Event> event_ptr(event); | 393 scoped_ptr<Event> event_ptr(event); |
392 if (!in_extension()) { | |
393 NOTREACHED(); | |
394 return; | |
395 } | |
396 | 394 |
not at google - send to devlin
2014/08/07 23:06:02
but you'll still need this. it's not an important
Fady Samuel
2014/08/07 23:09:29
Will the event router work in WebUI? Will WebUI re
not at google - send to devlin
2014/08/07 23:13:54
yes, this is one of the things I made work.
howev
ericzeng
2014/08/08 00:23:46
What do you mean by I'll still need it? Won't it c
not at google - send to devlin
2014/08/08 14:08:15
I meant you'll still need to make this change :) b
| |
397 if (!attached()) { | 395 if (!attached()) { |
398 pending_events_.push_back(linked_ptr<Event>(event_ptr.release())); | 396 pending_events_.push_back(linked_ptr<Event>(event_ptr.release())); |
399 return; | 397 return; |
400 } | 398 } |
401 | 399 |
402 extensions::EventFilteringInfo info; | 400 extensions::EventFilteringInfo info; |
403 info.SetInstanceID(view_instance_id_); | 401 info.SetInstanceID(view_instance_id_); |
404 scoped_ptr<base::ListValue> args(new base::ListValue()); | 402 scoped_ptr<base::ListValue> args(new base::ListValue()); |
405 args->Append(event->GetArguments().release()); | 403 args->Append(event->GetArguments().release()); |
406 | 404 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 guest_web_contents); | 438 guest_web_contents); |
441 callback.Run(guest_web_contents); | 439 callback.Run(guest_web_contents); |
442 } | 440 } |
443 | 441 |
444 // static | 442 // static |
445 void GuestViewBase::RegisterGuestViewTypes() { | 443 void GuestViewBase::RegisterGuestViewTypes() { |
446 AppViewGuest::Register(); | 444 AppViewGuest::Register(); |
447 ExtensionOptionsGuest::Register(); | 445 ExtensionOptionsGuest::Register(); |
448 WebViewGuest::Register(); | 446 WebViewGuest::Register(); |
449 } | 447 } |
OLD | NEW |