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

Unified Diff: ios/web_view/internal/app/application_context.h

Issue 2894483003: Initialize ios/web_view translate with a system-wide URLRequestContext. (Closed)
Patch Set: Respond to comments. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: ios/web_view/internal/app/application_context.h
diff --git a/ios/web_view/internal/app/application_context.h b/ios/web_view/internal/app/application_context.h
new file mode 100644
index 0000000000000000000000000000000000000000..33b4d39429b4824521cd153fc5da63bf8f67643e
--- /dev/null
+++ b/ios/web_view/internal/app/application_context.h
@@ -0,0 +1,61 @@
+// 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_H_
+#define IOS_WEB_VIEW_INTERNAL_APP_APPLICATION_CONTEXT_H_
+
+#include <string>
+
+#include "base/macros.h"
+
+namespace net {
+class URLRequestContextGetter;
+}
+
+namespace net_log {
+class ChromeNetLog;
+}
+
+class PrefService;
+class WebViewIOThread;
+
+namespace ios_web_view {
+
+class ApplicationContext;
+
+// Gets the global application context. Cannot return null.
+ApplicationContext* GetApplicationContext();
+
+// Defines application level globals.
+class ApplicationContext {
+ public:
+ // Gets the preferences associated with this application.
+ virtual PrefService* GetLocalState() = 0;
+
+ // Gets the URL request context associated with this application.
+ virtual net::URLRequestContextGetter* GetSystemURLRequestContext() = 0;
+
+ // Gets the locale used by the application.
+ virtual const std::string& GetApplicationLocale() = 0;
+
+ protected:
+ ApplicationContext();
+ virtual ~ApplicationContext();
+
+ // Sets the global ApplicationContext instance.
+ static void SetApplicationContext(ApplicationContext* context);
+
+ // Gets the ChromeNetLog.
+ virtual net_log::ChromeNetLog* GetNetLog() = 0;
+
+ // Gets the WebViewIOThread.
+ virtual WebViewIOThread* GetWebViewIOThread() = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ApplicationContext);
+};
+
+} // namespace ios_web_view
+
+#endif // IOS_WEB_VIEW_INTERNAL_APP_APPLICATION_CONTEXT_H_

Powered by Google App Engine
This is Rietveld 408576698