shell_browser_state.mm 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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
  3. // found in the LICENSE file.
  4. #include "ios/web/shell/shell_browser_state.h"
  5. #include "base/base_paths.h"
  6. #include "base/files/file_path.h"
  7. #include "base/path_service.h"
  8. #include "base/threading/thread_restrictions.h"
  9. #include "ios/web/public/thread/web_task_traits.h"
  10. #include "ios/web/public/thread/web_thread.h"
  11. #include "ios/web/shell/shell_url_request_context_getter.h"
  12. #if !defined(__has_feature) || !__has_feature(objc_arc)
  13. #error "This file requires ARC support."
  14. #endif
  15. namespace web {
  16. ShellBrowserState::ShellBrowserState() : BrowserState() {
  17. CHECK(base::PathService::Get(base::DIR_APP_DATA, &path_));
  18. request_context_getter_ = new ShellURLRequestContextGetter(
  19. GetStatePath(), this, web::GetIOThreadTaskRunner({}));
  20. }
  21. ShellBrowserState::~ShellBrowserState() {
  22. }
  23. bool ShellBrowserState::IsOffTheRecord() const {
  24. return false;
  25. }
  26. base::FilePath ShellBrowserState::GetStatePath() const {
  27. return path_;
  28. }
  29. net::URLRequestContextGetter* ShellBrowserState::GetRequestContext() {
  30. return request_context_getter_.get();
  31. }
  32. } // namespace web