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/guest_view/guest_view_base.h" | 5 #include "extensions/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 "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 CHECK(embedder_web_contents); | 133 CHECK(embedder_web_contents); |
134 int embedder_process_id = | 134 int embedder_process_id = |
135 embedder_web_contents->GetRenderProcessHost()->GetID(); | 135 embedder_web_contents->GetRenderProcessHost()->GetID(); |
136 | 136 |
137 Feature::Availability availability = feature->IsAvailableToContext( | 137 Feature::Availability availability = feature->IsAvailableToContext( |
138 embedder_extension, | 138 embedder_extension, |
139 process_map->GetMostLikelyContextType(embedder_extension, | 139 process_map->GetMostLikelyContextType(embedder_extension, |
140 embedder_process_id), | 140 embedder_process_id), |
141 embedder_web_contents->GetLastCommittedURL()); | 141 embedder_web_contents->GetLastCommittedURL()); |
142 if (!availability.is_available()) { | 142 if (!availability.is_available()) { |
| 143 // The derived class did not create a WebContents so this class serves no |
| 144 // purpose. Let's self-destruct. |
| 145 delete this; |
143 callback.Run(NULL); | 146 callback.Run(NULL); |
144 return; | 147 return; |
145 } | 148 } |
146 | 149 |
147 CreateWebContents(embedder_extension_id, | 150 CreateWebContents(embedder_extension_id, |
148 embedder_process_id, | 151 embedder_process_id, |
149 create_params, | 152 create_params, |
150 base::Bind(&GuestViewBase::CompleteInit, | 153 base::Bind(&GuestViewBase::CompleteInit, |
151 AsWeakPtr(), | 154 AsWeakPtr(), |
152 embedder_extension_id, | 155 embedder_extension_id, |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 | 479 |
477 // static | 480 // static |
478 void GuestViewBase::RegisterGuestViewTypes() { | 481 void GuestViewBase::RegisterGuestViewTypes() { |
479 AppViewGuest::Register(); | 482 AppViewGuest::Register(); |
480 ExtensionOptionsGuest::Register(); | 483 ExtensionOptionsGuest::Register(); |
481 MimeHandlerViewGuest::Register(); | 484 MimeHandlerViewGuest::Register(); |
482 WebViewGuest::Register(); | 485 WebViewGuest::Register(); |
483 } | 486 } |
484 | 487 |
485 } // namespace extensions | 488 } // namespace extensions |
OLD | NEW |