Chromium Code Reviews| Index: ios/web_view/internal/app/application_context_impl.h |
| diff --git a/ios/web_view/internal/app/application_context_impl.h b/ios/web_view/internal/app/application_context_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b4f7ec533a7fcfd61e5c86a173890e880c25254e |
| --- /dev/null |
| +++ b/ios/web_view/internal/app/application_context_impl.h |
| @@ -0,0 +1,69 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef IOS_WEB_VIEW_INTERNAL_APP_APPLICATION_CONTEXT_IMPL_H_ |
| +#define IOS_WEB_VIEW_INTERNAL_APP_APPLICATION_CONTEXT_IMPL_H_ |
| + |
| +#include <memory> |
| +#include <string> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/threading/thread_checker.h" |
| +#include "ios/web_view/internal/app/application_context.h" |
| + |
| +namespace ios_web_view { |
| + |
| +// Exposes application global state objects. This class is not a standard |
| +// singleton (from //base/memory/singleton.h) because it's creation relies on |
| +// on two parameters. |
| +class ApplicationContextImpl : public ApplicationContext { |
|
Eugene But (OOO till 7-30)
2017/05/25 00:39:11
What is the reason in separating ApplicationContex
michaeldo
2017/05/25 21:49:54
No reason any longer. I removed the _impl class fr
|
| + public: |
| + ApplicationContextImpl(const base::CommandLine& command_line, |
| + const std::string& locale); |
| + ~ApplicationContextImpl() override; |
| + |
| + // Creates state tied to application threads. |
| + void PreCreateThreads(); |
| + |
| + // Saves applicaiton context state. |
| + void SaveState(); |
| + |
| + // Destroys state tied to application threads. |
| + void PostDestroyThreads(); |
| + |
| + // ApplicationContext implementation. |
| + PrefService* GetLocalState() override; |
| + net_log::ChromeNetLog* GetNetLog() override; |
| + net::URLRequestContextGetter* GetSystemURLRequestContext() override; |
| + const std::string& GetApplicationLocale() override; |
| + WebViewIOThread* GetWebViewIOThread() override; |
| + |
| + private: |
| + // Returns the path to the application level preferences. |
| + static base::FilePath GetLocalStatePath(); |
| + |
| + // Sets the locale used by the application. |
| + void SetApplicationLocale(const std::string& locale); |
| + |
| + // Creates the application level preferences. |
| + void CreateLocalState(); |
| + |
| + THREAD_CHECKER(thread_checker_); |
| + std::unique_ptr<PrefService> local_state_; |
| + std::unique_ptr<net_log::ChromeNetLog> net_log_; |
| + std::unique_ptr<WebViewIOThread> web_view_io_thread_; |
| + std::string application_locale_; |
| + |
| + // Sequenced task runner for local state related I/O tasks. |
| + const scoped_refptr<base::SequencedTaskRunner> local_state_task_runner_; |
| + |
| + bool created_local_state_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ApplicationContextImpl); |
| +}; |
| + |
| +} // namespace ios_web_view |
| + |
| +#endif // IOS_WEB_VIEW_INTERNAL_APP_APPLICATION_CONTEXT_IMPL_H_ |