Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_BLOB_HOLDER_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_BLOB_HOLDER_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/memory/scoped_vector.h" | |
| 10 #include "content/public/browser/web_contents_observer.h" | |
| 11 #include "content/public/browser/web_contents_user_data.h" | |
| 12 | |
| 13 namespace content { | |
| 14 class BlobHandle; | |
| 15 } | |
| 16 | |
| 17 namespace extensions { | |
| 18 | |
| 19 // Used for holding onto Blobs created into the browser process until a | |
| 20 // renderer takes over ownership. | |
| 21 class BlobHolder : public content::WebContentsObserver, | |
| 22 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
| |
| 23 public: | |
| 24 virtual ~BlobHolder(); | |
| 25 | |
| 26 void HoldBlobReference(scoped_ptr<content::BlobHandle> blob); | |
| 27 | |
| 28 private: | |
| 29 typedef ScopedVector<content::BlobHandle> BlobHandleVector; | |
| 30 | |
| 31 explicit BlobHolder(content::WebContents* web_contents); | |
| 32 friend class content::WebContentsUserData<BlobHolder>; | |
| 33 | |
| 34 bool ContainsBlobHandle(content::BlobHandle* handle) const; | |
| 35 | |
| 36 // content::WebContentsObserver overrides. | |
| 37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 38 | |
| 39 // Message handlers. | |
| 40 void OnTransferBlobsAck(const std::vector<std::string>& blob_uuids); | |
| 41 | |
| 42 BlobHandleVector held_blobs_; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(BlobHolder); | |
| 45 }; | |
| 46 | |
| 47 } // namespace extensions | |
| 48 | |
| 49 #endif // CHROME_BROWSER_EXTENSIONS_BLOB_HOLDER_H_ | |
| OLD | NEW |