OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/streams_private/streams_private_api.h" | 5 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 if (!extension) | 78 if (!extension) |
79 return; | 79 return; |
80 | 80 |
81 MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension); | 81 MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension); |
82 // If the mime handler uses MimeHandlerViewGuest, the MimeHandlerViewGuest | 82 // If the mime handler uses MimeHandlerViewGuest, the MimeHandlerViewGuest |
83 // will take ownership of the stream. Otherwise, store the stream handle in | 83 // will take ownership of the stream. Otherwise, store the stream handle in |
84 // |streams_| and fire an event notifying the extension. | 84 // |streams_| and fire an event notifying the extension. |
85 if (handler->HasPlugin()) { | 85 if (handler->HasPlugin()) { |
86 GURL handler_url(Extension::GetBaseURLFromExtensionId(extension_id).spec() + | 86 GURL handler_url(Extension::GetBaseURLFromExtensionId(extension_id).spec() + |
87 handler->handler_url()); | 87 handler->handler_url()); |
88 auto tab_id = ExtensionTabUtil::GetTabId(web_contents); | 88 int tab_id = ExtensionTabUtil::GetTabId(web_contents); |
89 std::unique_ptr<StreamContainer> stream_container(new StreamContainer( | 89 std::unique_ptr<StreamContainer> stream_container(new StreamContainer( |
90 std::move(stream), tab_id, embedded, handler_url, extension_id)); | 90 std::move(stream), tab_id, embedded, handler_url, extension_id)); |
91 MimeHandlerStreamManager::Get(browser_context_) | 91 MimeHandlerStreamManager::Get(browser_context_) |
92 ->AddStream(view_id, std::move(stream_container), render_process_id, | 92 ->AddStream(view_id, std::move(stream_container), render_process_id, |
93 render_frame_id); | 93 render_frame_id); |
94 return; | 94 return; |
95 } | 95 } |
96 // Create the event's arguments value. | 96 // Create the event's arguments value. |
97 streams_private::StreamInfo info; | 97 streams_private::StreamInfo info; |
98 info.mime_type = stream->mime_type; | 98 info.mime_type = stream->mime_type; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> > | 172 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> > |
173 g_factory = LAZY_INSTANCE_INITIALIZER; | 173 g_factory = LAZY_INSTANCE_INITIALIZER; |
174 | 174 |
175 // static | 175 // static |
176 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* | 176 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* |
177 StreamsPrivateAPI::GetFactoryInstance() { | 177 StreamsPrivateAPI::GetFactoryInstance() { |
178 return g_factory.Pointer(); | 178 return g_factory.Pointer(); |
179 } | 179 } |
180 | 180 |
181 } // namespace extensions | 181 } // namespace extensions |
OLD | NEW |