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

Side by Side Diff: content/browser/resource_context_impl.cc

Issue 143003031: Allow retrieval of media device ID salt even after ResourceContext has gone away. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add TODO about proper fix. Created 6 years, 10 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/resource_context_impl.h" 5 #include "content/browser/resource_context_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/fileapi/chrome_blob_storage_context.h" 8 #include "content/browser/fileapi/chrome_blob_storage_context.h"
9 #include "content/browser/host_zoom_map_impl.h" 9 #include "content/browser/host_zoom_map_impl.h"
10 #include "content/browser/loader/resource_dispatcher_host_impl.h" 10 #include "content/browser/loader/resource_dispatcher_host_impl.h"
(...skipping 19 matching lines...) Expand all
30 30
31 class NonOwningZoomData : public base::SupportsUserData::Data { 31 class NonOwningZoomData : public base::SupportsUserData::Data {
32 public: 32 public:
33 explicit NonOwningZoomData(HostZoomMap* hzm) : host_zoom_map_(hzm) {} 33 explicit NonOwningZoomData(HostZoomMap* hzm) : host_zoom_map_(hzm) {}
34 HostZoomMap* host_zoom_map() { return host_zoom_map_; } 34 HostZoomMap* host_zoom_map() { return host_zoom_map_; }
35 35
36 private: 36 private:
37 HostZoomMap* host_zoom_map_; 37 HostZoomMap* host_zoom_map_;
38 }; 38 };
39 39
40 // Used by the default implementation of GetMediaDeviceIDSalt, below.
41 std::string ReturnEmptySalt() {
42 return std::string();
43 }
44
40 } // namespace 45 } // namespace
41 46
42 47
43 ResourceContext::ResourceContext() { 48 ResourceContext::ResourceContext() {
44 if (ResourceDispatcherHostImpl::Get()) 49 if (ResourceDispatcherHostImpl::Get())
45 ResourceDispatcherHostImpl::Get()->AddResourceContext(this); 50 ResourceDispatcherHostImpl::Get()->AddResourceContext(this);
46 } 51 }
47 52
48 ResourceContext::~ResourceContext() { 53 ResourceContext::~ResourceContext() {
49 ResourceDispatcherHostImpl* rdhi = ResourceDispatcherHostImpl::Get(); 54 ResourceDispatcherHostImpl* rdhi = ResourceDispatcherHostImpl::Get();
50 if (rdhi) { 55 if (rdhi) {
51 rdhi->CancelRequestsForContext(this); 56 rdhi->CancelRequestsForContext(this);
52 rdhi->RemoveResourceContext(this); 57 rdhi->RemoveResourceContext(this);
53 } 58 }
54 59
55 // In some tests this object is destructed on UI thread. 60 // In some tests this object is destructed on UI thread.
56 DetachUserDataThread(); 61 DetachUserDataThread();
57 } 62 }
58 63
59 std::string ResourceContext::GetMediaDeviceIDSalt() { 64 ResourceContext::SaltCallback ResourceContext::GetMediaDeviceIDSalt() {
60 return std::string(); 65 return base::Bind(&ReturnEmptySalt);
61 } 66 }
62 67
63 scoped_ptr<net::ClientCertStore> ResourceContext::CreateClientCertStore() { 68 scoped_ptr<net::ClientCertStore> ResourceContext::CreateClientCertStore() {
64 return scoped_ptr<net::ClientCertStore>(); 69 return scoped_ptr<net::ClientCertStore>();
65 } 70 }
66 71
67 void ResourceContext::CreateKeygenHandler( 72 void ResourceContext::CreateKeygenHandler(
68 uint32 key_size_in_bits, 73 uint32 key_size_in_bits,
69 const std::string& challenge_string, 74 const std::string& challenge_string,
70 const GURL& url, 75 const GURL& url,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // store a non-owning pointer here. 127 // store a non-owning pointer here.
123 resource_context->SetUserData( 128 resource_context->SetUserData(
124 kHostZoomMapKeyName, 129 kHostZoomMapKeyName,
125 new NonOwningZoomData( 130 new NonOwningZoomData(
126 HostZoomMap::GetForBrowserContext(browser_context))); 131 HostZoomMap::GetForBrowserContext(browser_context)));
127 132
128 resource_context->DetachUserDataThread(); 133 resource_context->DetachUserDataThread();
129 } 134 }
130 135
131 } // namespace content 136 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_host_unittest.cc ('k') | content/public/browser/media_device_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698