| 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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/extensions/extension_tab_util.h" | 9 #include "chrome/browser/extensions/extension_tab_util.h" |
| 10 #include "chrome/common/extensions/api/streams_private.h" | 10 #include "chrome/common/extensions/api/streams_private.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 StreamsPrivateAPI::~StreamsPrivateAPI() { | 58 StreamsPrivateAPI::~StreamsPrivateAPI() { |
| 59 } | 59 } |
| 60 | 60 |
| 61 void StreamsPrivateAPI::ExecuteMimeTypeHandler( | 61 void StreamsPrivateAPI::ExecuteMimeTypeHandler( |
| 62 const std::string& extension_id, | 62 const std::string& extension_id, |
| 63 content::WebContents* web_contents, | 63 content::WebContents* web_contents, |
| 64 scoped_ptr<content::StreamInfo> stream, | 64 scoped_ptr<content::StreamInfo> stream, |
| 65 const std::string& view_id, | 65 const std::string& view_id, |
| 66 int64 expected_content_size) { | 66 int64 expected_content_size, |
| 67 bool embedded) { |
| 67 // Create the event's arguments value. | 68 // Create the event's arguments value. |
| 68 streams_private::StreamInfo info; | 69 streams_private::StreamInfo info; |
| 69 info.mime_type = stream->mime_type; | 70 info.mime_type = stream->mime_type; |
| 70 info.original_url = stream->original_url.spec(); | 71 info.original_url = stream->original_url.spec(); |
| 71 info.stream_url = stream->handle->GetURL().spec(); | 72 info.stream_url = stream->handle->GetURL().spec(); |
| 72 info.tab_id = ExtensionTabUtil::GetTabId(web_contents); | 73 info.tab_id = ExtensionTabUtil::GetTabId(web_contents); |
| 74 info.embedded = embedded; |
| 73 | 75 |
| 74 if (!view_id.empty()) { | 76 if (!view_id.empty()) { |
| 75 info.view_id.reset(new std::string(view_id)); | 77 info.view_id.reset(new std::string(view_id)); |
| 76 } | 78 } |
| 77 | 79 |
| 78 int size = -1; | 80 int size = -1; |
| 79 if (expected_content_size <= INT_MAX) | 81 if (expected_content_size <= INT_MAX) |
| 80 size = expected_content_size; | 82 size = expected_content_size; |
| 81 info.expected_content_size = size; | 83 info.expected_content_size = size; |
| 82 | 84 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> > | 143 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> > |
| 142 g_factory = LAZY_INSTANCE_INITIALIZER; | 144 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 143 | 145 |
| 144 // static | 146 // static |
| 145 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* | 147 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* |
| 146 StreamsPrivateAPI::GetFactoryInstance() { | 148 StreamsPrivateAPI::GetFactoryInstance() { |
| 147 return g_factory.Pointer(); | 149 return g_factory.Pointer(); |
| 148 } | 150 } |
| 149 | 151 |
| 150 } // namespace extensions | 152 } // namespace extensions |
| OLD | NEW |