Chromium Code Reviews| Index: chrome/browser/extensions/blob_holder.h |
| diff --git a/chrome/browser/extensions/blob_holder.h b/chrome/browser/extensions/blob_holder.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d121653d7937a4d638dfd6f14bae0630ebcabe49 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/blob_holder.h |
| @@ -0,0 +1,49 @@ |
| +// Copyright 2014 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. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_BLOB_HOLDER_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_BLOB_HOLDER_H_ |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/scoped_vector.h" |
| +#include "content/public/browser/web_contents_observer.h" |
| +#include "content/public/browser/web_contents_user_data.h" |
| + |
| +namespace content { |
| +class BlobHandle; |
| +} |
| + |
| +namespace extensions { |
| + |
| +// Used for holding onto Blobs created into the browser process until a |
| +// renderer takes over ownership. |
| +class BlobHolder : public content::WebContentsObserver, |
| + public content::WebContentsUserData<BlobHolder> { |
|
michaeln
2014/05/23 00:12:34
Since WebContents can outlive/span processes, i th
tommycli
2014/05/23 16:27:44
Actually that makes a lot of sense. I basically ma
|
| + public: |
| + virtual ~BlobHolder(); |
| + |
| + void HoldBlobReference(scoped_ptr<content::BlobHandle> blob); |
| + |
| + private: |
| + typedef ScopedVector<content::BlobHandle> BlobHandleVector; |
| + |
| + explicit BlobHolder(content::WebContents* web_contents); |
| + friend class content::WebContentsUserData<BlobHolder>; |
| + |
| + bool ContainsBlobHandle(content::BlobHandle* handle) const; |
| + |
| + // content::WebContentsObserver overrides. |
| + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| + |
| + // Message handlers. |
| + void OnTransferBlobsAck(const std::vector<std::string>& blob_uuids); |
| + |
| + BlobHandleVector held_blobs_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BlobHolder); |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_BLOB_HOLDER_H_ |