create helper class to read blob data

This commit is contained in:
deepak1556 2016-08-31 05:38:32 +05:30
parent 5cbc8d5c71
commit 7b85ca0301
12 changed files with 251 additions and 153 deletions

View file

@ -5,6 +5,7 @@
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/api/atom_api_protocol.h"
#include "atom/browser/atom_blob_reader.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_download_manager_delegate.h"
#include "atom/browser/atom_permission_manager.h"
@ -30,7 +31,9 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_registry_simple.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/user_agent.h"
#include "net/ftp/ftp_network_layer.h"
@ -207,6 +210,19 @@ void AtomBrowserContext::RegisterPrefs(PrefRegistrySimple* pref_registry) {
pref_registry->RegisterDictionaryPref(prefs::kDevToolsFileSystemPaths);
}
AtomBlobReader* AtomBrowserContext::GetBlobReader() {
if (!blob_reader_.get()) {
content::ChromeBlobStorageContext* blob_context =
content::ChromeBlobStorageContext::GetFor(this);
storage::FileSystemContext* file_system_context =
content::BrowserContext::GetStoragePartition(
this, nullptr)->GetFileSystemContext();
blob_reader_.reset(new AtomBlobReader(blob_context,
file_system_context));
}
return blob_reader_.get();
}
// static
scoped_refptr<AtomBrowserContext> AtomBrowserContext::From(
const std::string& partition, bool in_memory,