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

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: 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..44fca95d5e80b3e277f6f6652442e6acb950673f
--- /dev/null
+++ b/ios/web_view/internal/app/application_context.h
@@ -0,0 +1,55 @@
+// 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 ApplicationContext;
+class PrefService;
+class WebViewIOThread;
+
+// Gets the global application context. Cannot return null.
+ApplicationContext* GetApplicationContext();
Eugene But (OOO till 7-30) 2017/05/18 23:54:54 Should this be a singleton from base/memory/single
michaeldo 2017/05/19 22:02:35 This is not a singleton in chrome/browser/io_threa
Eugene But (OOO till 7-30) 2017/05/19 23:32:05 If this interface should not be singleton, then ma
michaeldo 2017/05/23 22:38:36 I took another look at this and was able to make i
+
+class ApplicationContext {
Eugene But (OOO till 7-30) 2017/05/18 23:54:54 Please add comments
Hiroshi Ichikawa 2017/05/19 02:37:51 Shouldn't this class be inside a namespace?
michaeldo 2017/05/19 22:02:35 I think so? While many other classes are namespace
michaeldo 2017/05/19 22:02:35 Done.
+ public:
+ ApplicationContext();
Eugene But (OOO till 7-30) 2017/05/18 23:54:54 Should constructor/destructor be protected?
michaeldo 2017/05/19 22:02:35 Makes sense, Done.
+ virtual ~ApplicationContext();
+
+ // Gets the local state 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:
+ // 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);
+};
+
+#endif // IOS_WEB_VIEW_INTERNAL_APP_APPLICATION_CONTEXT_H_

Powered by Google App Engine
This is Rietveld 408576698