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

Side by Side Diff: extensions/renderer/guest_view/guest_view_container.cc

Issue 638703004: Fix mime-handler-view crash upon creation: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/renderer/guest_view/guest_view_container.h" 5 #include "extensions/renderer/guest_view/guest_view_container.h"
6 6
7 #include "content/public/renderer/browser_plugin_delegate.h" 7 #include "content/public/renderer/browser_plugin_delegate.h"
8 #include "content/public/renderer/render_frame.h" 8 #include "content/public/renderer/render_frame.h"
9 #include "content/public/renderer/render_view.h" 9 #include "content/public/renderer/render_view.h"
10 #include "extensions/common/extension_messages.h" 10 #include "extensions/common/extension_messages.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 int element_instance_id) { 141 int element_instance_id) {
142 DCHECK_NE(element_instance_id_, guestview::kInstanceIDNone); 142 DCHECK_NE(element_instance_id_, guestview::kInstanceIDNone);
143 DCHECK_EQ(element_instance_id_, element_instance_id); 143 DCHECK_EQ(element_instance_id_, element_instance_id);
144 DCHECK(!mime_type_.empty()); 144 DCHECK(!mime_type_.empty());
145 render_frame()->AttachGuest(element_instance_id); 145 render_frame()->AttachGuest(element_instance_id);
146 } 146 }
147 147
148 void GuestViewContainer::OnGuestAttached(int element_instance_id, 148 void GuestViewContainer::OnGuestAttached(int element_instance_id,
149 int guest_proxy_routing_id) { 149 int guest_proxy_routing_id) {
150 attached_ = true; 150 attached_ = true;
151
152 if (!mime_type_.empty()) {
153 // MimeHandlerView's creation and attachment is not done via JS API.
154 return;
155 }
156
151 // Handle the callback for the current request with a pending response. 157 // Handle the callback for the current request with a pending response.
152 HandlePendingResponseCallback(guest_proxy_routing_id); 158 HandlePendingResponseCallback(guest_proxy_routing_id);
153 // Perform the subsequent attach request if one exists. 159 // Perform the subsequent attach request if one exists.
154 PerformPendingAttachRequest(); 160 PerformPendingAttachRequest();
155 } 161 }
156 162
157 void GuestViewContainer::AttachGuestInternal( 163 void GuestViewContainer::AttachGuestInternal(
158 linked_ptr<AttachRequest> request) { 164 linked_ptr<AttachRequest> request) {
159 CHECK(!pending_response_.get()); 165 CHECK(!pending_response_.get());
160 // Step 1, send the attach params to chrome/. 166 // Step 1, send the attach params to chrome/.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 case ExtensionMsg_CreateMimeHandlerViewGuestACK::ID: 231 case ExtensionMsg_CreateMimeHandlerViewGuestACK::ID:
226 case ExtensionMsg_GuestAttached::ID: 232 case ExtensionMsg_GuestAttached::ID:
227 return true; 233 return true;
228 default: 234 default:
229 break; 235 break;
230 } 236 }
231 return false; 237 return false;
232 } 238 }
233 239
234 } // namespace extensions 240 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698