| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "ios/web/shell/shell_browser_state.h" | 5 #include "ios/web/shell/shell_browser_state.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
| 13 #include "ios/web/public/web_thread.h" | 13 #include "ios/web/public/web_thread.h" |
| 14 #include "ios/web/shell/shell_url_request_context_getter.h" | 14 #include "ios/web/shell/shell_url_request_context_getter.h" |
| 15 | 15 |
| 16 namespace web { | 16 namespace web { |
| 17 | 17 |
| 18 ShellBrowserState::ShellBrowserState() : BrowserState() { | 18 ShellBrowserState::ShellBrowserState() : BrowserState() { |
| 19 CHECK(PathService::Get(base::DIR_APP_DATA, &path_)); | 19 CHECK(PathService::Get(base::DIR_APP_DATA, &path_)); |
| 20 | 20 |
| 21 request_context_getter_ = new ShellURLRequestContextGetter( | 21 request_context_getter_ = new ShellURLRequestContextGetter( |
| 22 GetStatePath(), | 22 GetStatePath(), |
| 23 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO), | 23 web::WebThread::GetMessageLoopProxyForThread(web::WebThread::IO), |
| 24 web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE), | 24 web::WebThread::GetMessageLoopProxyForThread(web::WebThread::FILE), |
| 25 web::WebThread::GetTaskRunnerForThread(web::WebThread::CACHE)); | 25 web::WebThread::GetMessageLoopProxyForThread(web::WebThread::CACHE)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 ShellBrowserState::~ShellBrowserState() { | 28 ShellBrowserState::~ShellBrowserState() { |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool ShellBrowserState::IsOffTheRecord() const { | 31 bool ShellBrowserState::IsOffTheRecord() const { |
| 32 return false; | 32 return false; |
| 33 } | 33 } |
| 34 | 34 |
| 35 base::FilePath ShellBrowserState::GetStatePath() const { | 35 base::FilePath ShellBrowserState::GetStatePath() const { |
| 36 return path_; | 36 return path_; |
| 37 } | 37 } |
| 38 | 38 |
| 39 net::URLRequestContextGetter* ShellBrowserState::GetRequestContext() { | 39 net::URLRequestContextGetter* ShellBrowserState::GetRequestContext() { |
| 40 return request_context_getter_.get(); | 40 return request_context_getter_.get(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace web | 43 } // namespace web |
| OLD | NEW |