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/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 Loading... |
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 Loading... |
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 |
OLD | NEW |