Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: chrome/browser/extensions/blob_holder.h

Issue 280393003: Blobs: Catching browser-process created Blobs in extension code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Kill RenderProcessHost on a bad UUID. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 class RenderViewHost;
16 }
17
18 namespace extensions {
19
20 // Used for holding onto Blobs created into the browser process until a
21 // renderer takes over ownership. Each Blob is associated with a specific
22 // RenderViewHost. If the RenderViewHost is deleted before it can take ownership
23 // of the Blob, the Blob reference is released.
24 class BlobHolder : public content::WebContentsObserver,
25 public content::WebContentsUserData<BlobHolder> {
26 public:
27 virtual ~BlobHolder();
28
29 void HoldBlobReference(content::RenderViewHost* render_view_host,
30 scoped_ptr<content::BlobHandle> blob);
31
32 private:
33 struct BlobHolderData;
34
35 explicit BlobHolder(content::WebContents* web_contents);
36 friend class content::WebContentsUserData<BlobHolder>;
37
38 bool ContainsUUID(const std::string& uuid) const;
39
40 // content::WebContentsObserver overrides.
41 // Releases all the Blob references associated with this render_view_host.
42 virtual void RenderViewDeleted(
43 content::RenderViewHost* render_view_host) OVERRIDE;
44 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
45
46 // Message handlers.
47 void OnBlobOwnershipTaken(const std::string& uuid);
48
49 // The BlobHandles associated with each RenderViewHost.
50 ScopedVector<BlobHolderData> held_blobs_;
51
52 DISALLOW_COPY_AND_ASSIGN(BlobHolder);
53 };
54
55 } // namespace extensions
56
57 #endif // CHROME_BROWSER_EXTENSIONS_BLOB_HOLDER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/blob_holder.cc » ('j') | chrome/browser/extensions/blob_holder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698