OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/shell/shell_browser_context.h" | 5 #include "content/shell/shell_browser_context.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "content/browser/appcache/chrome_appcache_service.h" | 10 #include "content/browser/appcache/chrome_appcache_service.h" |
11 #include "content/browser/chrome_blob_storage_context.h" | 11 #include "content/browser/chrome_blob_storage_context.h" |
| 12 #include "content/browser/download/download_id_factory.h" |
12 #include "content/browser/download/download_manager.h" | 13 #include "content/browser/download/download_manager.h" |
13 #include "content/browser/download/download_status_updater.h" | 14 #include "content/browser/download/download_status_updater.h" |
14 #include "content/browser/file_system/browser_file_system_helper.h" | 15 #include "content/browser/file_system/browser_file_system_helper.h" |
15 #include "content/browser/geolocation/geolocation_permission_context.h" | 16 #include "content/browser/geolocation/geolocation_permission_context.h" |
16 #include "content/browser/host_zoom_map.h" | 17 #include "content/browser/host_zoom_map.h" |
17 #include "content/browser/in_process_webkit/webkit_context.h" | 18 #include "content/browser/in_process_webkit/webkit_context.h" |
18 #include "content/browser/speech/speech_input_preferences.h" | 19 #include "content/browser/speech/speech_input_preferences.h" |
19 #include "content/browser/ssl/ssl_host_state.h" | 20 #include "content/browser/ssl/ssl_host_state.h" |
20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
21 #include "content/shell/shell_browser_main.h" | 22 #include "content/shell/shell_browser_main.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 private: | 74 private: |
74 DISALLOW_COPY_AND_ASSIGN(ShellSpeechInputPreferences); | 75 DISALLOW_COPY_AND_ASSIGN(ShellSpeechInputPreferences); |
75 }; | 76 }; |
76 | 77 |
77 } // namespace | 78 } // namespace |
78 | 79 |
79 namespace content { | 80 namespace content { |
80 | 81 |
81 ShellBrowserContext::ShellBrowserContext( | 82 ShellBrowserContext::ShellBrowserContext( |
82 ShellBrowserMainParts* shell_main_parts) | 83 ShellBrowserMainParts* shell_main_parts) |
83 : shell_main_parts_(shell_main_parts) { | 84 : download_id_factory_(new DownloadIdFactory(this)), |
| 85 shell_main_parts_(shell_main_parts) { |
84 } | 86 } |
85 | 87 |
86 ShellBrowserContext::~ShellBrowserContext() { | 88 ShellBrowserContext::~ShellBrowserContext() { |
87 if (resource_context_.get()) { | 89 if (resource_context_.get()) { |
88 BrowserThread::DeleteSoon( | 90 BrowserThread::DeleteSoon( |
89 BrowserThread::IO, FROM_HERE, resource_context_.release()); | 91 BrowserThread::IO, FROM_HERE, resource_context_.release()); |
90 } | 92 } |
91 } | 93 } |
92 | 94 |
93 FilePath ShellBrowserContext::GetPath() { | 95 FilePath ShellBrowserContext::GetPath() { |
(...skipping 22 matching lines...) Expand all Loading... |
116 ssl_host_state_.reset(new SSLHostState()); | 118 ssl_host_state_.reset(new SSLHostState()); |
117 return ssl_host_state_.get(); | 119 return ssl_host_state_.get(); |
118 } | 120 } |
119 | 121 |
120 DownloadManager* ShellBrowserContext::GetDownloadManager() { | 122 DownloadManager* ShellBrowserContext::GetDownloadManager() { |
121 if (!download_manager_.get()) { | 123 if (!download_manager_.get()) { |
122 download_status_updater_.reset(new DownloadStatusUpdater()); | 124 download_status_updater_.reset(new DownloadStatusUpdater()); |
123 | 125 |
124 download_manager_delegate_ = new ShellDownloadManagerDelegate(); | 126 download_manager_delegate_ = new ShellDownloadManagerDelegate(); |
125 download_manager_ = new DownloadManager(download_manager_delegate_, | 127 download_manager_ = new DownloadManager(download_manager_delegate_, |
| 128 download_id_factory_, |
126 download_status_updater_.get()); | 129 download_status_updater_.get()); |
127 download_manager_delegate_->SetDownloadManager(download_manager_.get()); | 130 download_manager_delegate_->SetDownloadManager(download_manager_.get()); |
128 download_manager_->Init(this); | 131 download_manager_->Init(this); |
129 } | 132 } |
130 return download_manager_.get(); | 133 return download_manager_.get(); |
131 } | 134 } |
132 | 135 |
133 net::URLRequestContextGetter* ShellBrowserContext::GetRequestContext() { | 136 net::URLRequestContextGetter* ShellBrowserContext::GetRequestContext() { |
134 if (!url_request_getter_) { | 137 if (!url_request_getter_) { |
135 url_request_getter_ = new ShellURLRequestContextGetter( | 138 url_request_getter_ = new ShellURLRequestContextGetter( |
(...skipping 13 matching lines...) Expand all Loading... |
149 net::URLRequestContextGetter* | 152 net::URLRequestContextGetter* |
150 ShellBrowserContext::GetRequestContextForMedia() { | 153 ShellBrowserContext::GetRequestContextForMedia() { |
151 return GetRequestContext(); | 154 return GetRequestContext(); |
152 } | 155 } |
153 | 156 |
154 const ResourceContext& ShellBrowserContext::GetResourceContext() { | 157 const ResourceContext& ShellBrowserContext::GetResourceContext() { |
155 if (!resource_context_.get()) { | 158 if (!resource_context_.get()) { |
156 resource_context_.reset(new ShellResourceContext( | 159 resource_context_.reset(new ShellResourceContext( |
157 static_cast<ShellURLRequestContextGetter*>(GetRequestContext()), | 160 static_cast<ShellURLRequestContextGetter*>(GetRequestContext()), |
158 GetBlobStorageContext(), | 161 GetBlobStorageContext(), |
159 GetDownloadManager()->GetNextIdThunk())); | 162 download_id_factory_)); |
160 } | 163 } |
161 return *resource_context_.get(); | 164 return *resource_context_.get(); |
162 } | 165 } |
163 | 166 |
164 HostZoomMap* ShellBrowserContext::GetHostZoomMap() { | 167 HostZoomMap* ShellBrowserContext::GetHostZoomMap() { |
165 if (!host_zoom_map_) | 168 if (!host_zoom_map_) |
166 host_zoom_map_ = new HostZoomMap(); | 169 host_zoom_map_ = new HostZoomMap(); |
167 return host_zoom_map_.get(); | 170 return host_zoom_map_.get(); |
168 } | 171 } |
169 | 172 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 NewRunnableMethod( | 251 NewRunnableMethod( |
249 appcache_service_.get(), | 252 appcache_service_.get(), |
250 &ChromeAppCacheService::InitializeOnIOThread, | 253 &ChromeAppCacheService::InitializeOnIOThread, |
251 IsOffTheRecord() | 254 IsOffTheRecord() |
252 ? FilePath() : GetPath().Append(FILE_PATH_LITERAL("AppCache")), | 255 ? FilePath() : GetPath().Append(FILE_PATH_LITERAL("AppCache")), |
253 &GetResourceContext(), | 256 &GetResourceContext(), |
254 special_storage_policy)); | 257 special_storage_policy)); |
255 } | 258 } |
256 | 259 |
257 } // namespace content | 260 } // namespace content |
OLD | NEW |