Chromium Code Reviews| Index: content/browser/streams/chrome_stream_registry.cc |
| diff --git a/content/browser/streams/chrome_stream_registry.cc b/content/browser/streams/chrome_stream_registry.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7a6c413f2c0b596cb87bd48a4b073112ef7b2151 |
| --- /dev/null |
| +++ b/content/browser/streams/chrome_stream_registry.cc |
| @@ -0,0 +1,53 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/browser/streams/chrome_stream_registry.h" |
| + |
| +#include <string> |
| + |
| +#include "base/guid.h" |
| +#include "base/stl_util.h" |
| +#include "base/string_number_conversions.h" |
| +#include "content/browser/streams/chrome_stream.h" |
| +#include "content/public/common/url_constants.h" |
| + |
| +namespace content { |
| + |
| +ChromeStreamRegistry::ChromeStreamRegistry() { |
| +} |
| + |
| +ChromeStreamRegistry::~ChromeStreamRegistry() { |
| +} |
| + |
| +void ChromeStreamRegistry::RegisterStream(scoped_refptr<ChromeStream> stream) { |
| + GURL url(std::string(chrome::kBlobScheme) + ":" + |
| + stream->security_origin().spec() + |
| + base::GenerateGUID()); |
| + stream->SetStreamUrl(url); |
| + stream->AddObserver(this); |
| + streams_[url] = stream; |
| +} |
| + |
| +scoped_refptr<ChromeStream> ChromeStreamRegistry::GetStream(const GURL& url) { |
| + std::map<GURL, scoped_refptr<ChromeStream> >::iterator stream = |
| + streams_.find(url); |
| + if (stream != streams_.end()) { |
| + return stream->second; |
| + } else { |
| + return NULL; |
| + } |
| +} |
| + |
| +void ChromeStreamRegistry::OnDataAvailable(ChromeStream* stream) { |
| +} |
| + |
| +void ChromeStreamRegistry::OnStreamComplete(ChromeStream* stream) { |
|
darin (slow to review)
2013/02/13 09:18:12
so does OnStreamComplete mean that the stream was
Zachary Kuznia
2013/02/13 16:37:14
Changed to OnStreamConsumed and now this is called
|
| + stream->RemoveObserver(this); |
| + streams_.erase(stream->stream_url()); |
| +} |
| + |
| +void ChromeStreamRegistry::OnBufferAvailable(ChromeStream* stream) { |
| +} |
| + |
| +} // namespace content |