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

Side by Side Diff: chrome/browser/renderer_host/blob_dispatcher_host.cc

Issue 3108042: Support sending BlobData to browser process. Also support sending UploadData... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 #include "chrome/browser/renderer_host/blob_dispatcher_host.h"
6
7 #include "chrome/browser/chrome_blob_storage_context.h"
8 #include "chrome/browser/chrome_thread.h"
9 #include "chrome/common/render_messages.h"
10 #include "googleurl/src/gurl.h"
11 #include "ipc/ipc_message.h"
12 #include "webkit/blob/blob_data.h"
13 #include "webkit/blob/blob_storage_controller.h"
14
15 BlobDispatcherHost::BlobDispatcherHost(
16 ChromeBlobStorageContext* blob_storage_context)
17 : blob_storage_context_(blob_storage_context) {
18 }
19
20 BlobDispatcherHost::~BlobDispatcherHost() {
21 }
22
23 void BlobDispatcherHost::Shutdown() {
24 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
25
26 // Unregister all the blob URLs that are previously registered in this
27 // process.
28 for (base::hash_set<std::string>::const_iterator iter = blob_urls_.begin();
29 iter != blob_urls_.end(); ++iter) {
30 blob_storage_context_->controller()->UnregisterBlobUrl(GURL(*iter));
31 }
32 }
33
34 bool BlobDispatcherHost::OnMessageReceived(const IPC::Message& message,
35 bool* msg_is_ok) {
36 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
37
38 *msg_is_ok = true;
39 bool handled = true;
40 IPC_BEGIN_MESSAGE_MAP_EX(BlobDispatcherHost, message, *msg_is_ok)
41 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterBlobUrl, OnRegisterBlobUrl)
42 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterBlobUrlFrom, OnRegisterBlobUrlFrom)
43 IPC_MESSAGE_HANDLER(ViewHostMsg_UnregisterBlobUrl, OnUnregisterBlobUrl)
44 IPC_MESSAGE_UNHANDLED(handled = false)
45 IPC_END_MESSAGE_MAP()
46 return handled;
47 }
48
49 void BlobDispatcherHost::OnRegisterBlobUrl(
50 const GURL& url, const scoped_refptr<webkit_blob::BlobData>& blob_data) {
51 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
52 blob_storage_context_->controller()->RegisterBlobUrl(url, blob_data);
53 blob_urls_.insert(url.spec());
54 }
55
56 void BlobDispatcherHost::OnRegisterBlobUrlFrom(
57 const GURL& url, const GURL& src_url) {
58 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
59 blob_storage_context_->controller()->RegisterBlobUrlFrom(url, src_url);
60 blob_urls_.insert(src_url.spec());
61 }
62
63 void BlobDispatcherHost::OnUnregisterBlobUrl(const GURL& url) {
64 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
65 blob_storage_context_->controller()->UnregisterBlobUrl(url);
66 blob_urls_.erase(url.spec());
67 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/blob_dispatcher_host.h ('k') | chrome/browser/renderer_host/resource_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698