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

Side by Side Diff: extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc

Issue 885563002: Fix a crash in MimeHandlerServiceImpl::AbortStream(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GN Created 5 years, 10 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
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/browser/guest_view/mime_handler_view/mime_handler_view_gues t.h" 5 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/browser/render_process_host.h" 9 #include "content/public/browser/render_process_host.h"
10 #include "content/public/browser/stream_handle.h" 10 #include "content/public/browser/stream_handle.h"
(...skipping 21 matching lines...) Expand all
32 int tab_id, 32 int tab_id,
33 bool embedded, 33 bool embedded,
34 const GURL& handler_url, 34 const GURL& handler_url,
35 const std::string& extension_id) 35 const std::string& extension_id)
36 : stream_(stream.Pass()), 36 : stream_(stream.Pass()),
37 embedded_(embedded), 37 embedded_(embedded),
38 tab_id_(tab_id), 38 tab_id_(tab_id),
39 handler_url_(handler_url), 39 handler_url_(handler_url),
40 extension_id_(extension_id), 40 extension_id_(extension_id),
41 weak_factory_(this) { 41 weak_factory_(this) {
42 DCHECK(stream_);
42 } 43 }
43 44
44 StreamContainer::~StreamContainer() { 45 StreamContainer::~StreamContainer() {
45 } 46 }
46 47
47 void StreamContainer::Abort(const base::Closure& callback) { 48 void StreamContainer::Abort(const base::Closure& callback) {
48 if (!stream_) { 49 if (!stream_->handle) {
49 callback.Run(); 50 callback.Run();
50 return; 51 return;
51 } 52 }
52 stream_->handle->AddCloseListener(callback); 53 stream_->handle->AddCloseListener(callback);
53 stream_->handle.reset(); 54 stream_->handle.reset();
54 } 55 }
55 56
56 base::WeakPtr<StreamContainer> StreamContainer::GetWeakPtr() { 57 base::WeakPtr<StreamContainer> StreamContainer::GetWeakPtr() {
57 return weak_factory_.GetWeakPtr(); 58 return weak_factory_.GetWeakPtr();
58 } 59 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 227
227 void MimeHandlerViewGuest::OnRequest( 228 void MimeHandlerViewGuest::OnRequest(
228 const ExtensionHostMsg_Request_Params& params) { 229 const ExtensionHostMsg_Request_Params& params) {
229 if (extension_function_dispatcher_) { 230 if (extension_function_dispatcher_) {
230 extension_function_dispatcher_->Dispatch( 231 extension_function_dispatcher_->Dispatch(
231 params, web_contents()->GetRenderViewHost()); 232 params, web_contents()->GetRenderViewHost());
232 } 233 }
233 } 234 }
234 235
235 } // namespace extensions 236 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc ('k') | extensions/extensions_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698