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/guest_view_constants.h" | 11 #include "chrome/browser/guest_view/guest_view_constants.h" |
11 #include "chrome/browser/guest_view/guest_view_manager.h" | 12 #include "chrome/browser/guest_view/guest_view_manager.h" |
12 #include "chrome/browser/guest_view/web_view/web_view_guest.h" | 13 #include "chrome/browser/guest_view/web_view/web_view_guest.h" |
13 #include "chrome/common/content_settings.h" | 14 #include "chrome/common/content_settings.h" |
14 #include "content/public/browser/render_frame_host.h" | 15 #include "content/public/browser/render_frame_host.h" |
15 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" |
16 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
18 #include "content/public/common/url_constants.h" | 19 #include "content/public/common/url_constants.h" |
19 #include "extensions/browser/event_router.h" | 20 #include "extensions/browser/event_router.h" |
21 #include "extensions/common/feature_switch.h" | |
Fady Samuel
2014/07/22 00:42:52
nit: This line isn't necessary right?
ericzeng
2014/07/22 01:45:26
Done.
| |
20 #include "third_party/WebKit/public/web/WebInputEvent.h" | 22 #include "third_party/WebKit/public/web/WebInputEvent.h" |
21 | 23 |
22 using content::WebContents; | 24 using content::WebContents; |
23 | 25 |
24 namespace { | 26 namespace { |
25 | 27 |
26 typedef std::map<std::string, GuestViewBase::GuestCreationCallback> | 28 typedef std::map<std::string, GuestViewBase::GuestCreationCallback> |
27 GuestViewCreationMap; | 29 GuestViewCreationMap; |
28 static base::LazyInstance<GuestViewCreationMap> guest_view_registry = | 30 static base::LazyInstance<GuestViewCreationMap> guest_view_registry = |
29 LAZY_INSTANCE_INITIALIZER; | 31 LAZY_INSTANCE_INITIALIZER; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 AddGuest(guest_instance_id_, guest_web_contents); | 141 AddGuest(guest_instance_id_, guest_web_contents); |
140 | 142 |
141 // Give the derived class an opportunity to perform additional initialization. | 143 // Give the derived class an opportunity to perform additional initialization. |
142 DidInitialize(); | 144 DidInitialize(); |
143 } | 145 } |
144 | 146 |
145 // static | 147 // static |
146 void GuestViewBase::RegisterGuestViewTypes() { | 148 void GuestViewBase::RegisterGuestViewTypes() { |
147 GuestView<WebViewGuest>::Register(); | 149 GuestView<WebViewGuest>::Register(); |
148 GuestView<AppViewGuest>::Register(); | 150 GuestView<AppViewGuest>::Register(); |
151 GuestView<ExtensionOptionsGuest>::Register(); | |
149 } | 152 } |
150 | 153 |
151 // static | 154 // static |
152 void GuestViewBase::RegisterGuestViewType( | 155 void GuestViewBase::RegisterGuestViewType( |
153 const std::string& view_type, | 156 const std::string& view_type, |
154 const GuestCreationCallback& callback) { | 157 const GuestCreationCallback& callback) { |
155 GuestViewCreationMap::iterator it = | 158 GuestViewCreationMap::iterator it = |
156 guest_view_registry.Get().find(view_type); | 159 guest_view_registry.Get().find(view_type); |
157 DCHECK(it == guest_view_registry.Get().end()); | 160 DCHECK(it == guest_view_registry.Get().end()); |
158 guest_view_registry.Get()[view_type] = callback; | 161 guest_view_registry.Get()[view_type] = callback; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 // purpose. Let's self-destruct. | 382 // purpose. Let's self-destruct. |
380 delete this; | 383 delete this; |
381 callback.Run(NULL); | 384 callback.Run(NULL); |
382 return; | 385 return; |
383 } | 386 } |
384 InitWithWebContents(embedder_extension_id, | 387 InitWithWebContents(embedder_extension_id, |
385 embedder_render_process_id, | 388 embedder_render_process_id, |
386 guest_web_contents); | 389 guest_web_contents); |
387 callback.Run(guest_web_contents); | 390 callback.Run(guest_web_contents); |
388 } | 391 } |
OLD | NEW |