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

Unified Diff: ios/components/io_thread/ios_io_thread.h

Issue 2908613002: Move common functionality of IOSChromeIOThread to ios/components. (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
« no previous file with comments | « ios/components/io_thread/DEPS ('k') | ios/components/io_thread/ios_io_thread.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/components/io_thread/ios_io_thread.h
diff --git a/ios/chrome/browser/ios_chrome_io_thread.h b/ios/components/io_thread/ios_io_thread.h
similarity index 81%
copy from ios/chrome/browser/ios_chrome_io_thread.h
copy to ios/components/io_thread/ios_io_thread.h
index bd1207f23153f6e42e64abce79190ef7fcd637ed..8895860828f1ae3b2bd7f1c517e55559c15d7c6d 100644
--- a/ios/chrome/browser/ios_chrome_io_thread.h
+++ b/ios/components/io_thread/ios_io_thread.h
@@ -1,9 +1,9 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// 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_CHROME_BROWSER_IOS_CHROME_IO_THREAD_H_
-#define IOS_CHROME_BROWSER_IOS_CHROME_IO_THREAD_H_
+#ifndef IOS_COMPONENTS_IO_THREAD_IOS_IO_THREAD_H_
+#define IOS_COMPONENTS_IO_THREAD_IOS_IO_THREAD_H_
#include <stddef.h>
#include <stdint.h>
@@ -27,7 +27,6 @@
class PrefProxyConfigTracker;
class PrefService;
-class SystemURLRequestContextGetter;
namespace net {
class CTPolicyEnforcer;
@@ -56,6 +55,8 @@ namespace net_log {
class ChromeNetLog;
} // namespace net_log
+namespace io_thread {
+
class SystemURLRequestContextGetter;
// Contains state associated with, initialized and cleaned up on, and
@@ -63,7 +64,7 @@ class SystemURLRequestContextGetter;
//
// If you are looking to interact with the IO thread (e.g. post tasks
// to it or check if it is the current thread), see web::WebThread.
-class IOSChromeIOThread : public web::WebThreadDelegate {
+class IOSIOThread : public web::WebThreadDelegate {
public:
struct Globals {
template <typename T>
@@ -127,17 +128,16 @@ class IOSChromeIOThread : public web::WebThreadDelegate {
std::unique_ptr<net::CTPolicyEnforcer> ct_policy_enforcer;
};
- // |net_log| must either outlive the IOSChromeIOThread or be NULL.
- IOSChromeIOThread(PrefService* local_state, net_log::ChromeNetLog* net_log);
-
- ~IOSChromeIOThread() override;
+ // |net_log| must either outlive the IOSIOThread or be NULL.
+ IOSIOThread(PrefService* local_state, net_log::ChromeNetLog* net_log);
+ ~IOSIOThread() override;
// Can only be called on the IO thread.
Globals* globals();
- // Allows overriding Globals in tests where IOSChromeIOThread::Init() and
- // IOSChromeIOThread::CleanUp() are not called. This allows for injecting
- // mocks into IOSChromeIOThread global objects.
+ // Allows overriding Globals in tests where IOSIOThread::Init() and
+ // IOSIOThread::CleanUp() are not called. This allows for injecting mocks
+ // into IOSIOThread global objects.
void SetGlobalsForTesting(Globals* globals);
net_log::ChromeNetLog* net_log();
@@ -157,6 +157,17 @@ class IOSChromeIOThread : public web::WebThreadDelegate {
base::TimeTicks creation_time() const;
+ protected:
+ // A string describing the current application version. For example: "stable"
+ // or "dev". An empty string is an acceptable value. This string is used to
+ // build the user agent id for QUIC.
+ virtual std::string GetChannelString() const = 0;
+
+ // Subclasses must return a NetworkDelegate to be used for
+ // BrowserState-agnostic network events.
+ virtual std::unique_ptr<net::NetworkDelegate>
+ CreateSystemNetworkDelegate() = 0;
+
private:
// Provide SystemURLRequestContextGetter with access to
// InitSystemRequestContext().
@@ -178,11 +189,13 @@ class IOSChromeIOThread : public web::WebThreadDelegate {
// SystemRequestContext state has been initialized on the UI thread.
void InitSystemRequestContextOnIOThread();
+ // Sets up HttpAuthPreferences and HttpAuthHandlerFactory on Globals.
void CreateDefaultAuthHandlerFactory();
// Returns an SSLConfigService instance.
net::SSLConfigService* GetSSLConfigService();
+ // Discards confidental data. To be called on IO thread only.
void ChangedToOnTheRecordOnIOThread();
static net::URLRequestContext* ConstructSystemRequestContext(
@@ -195,9 +208,9 @@ class IOSChromeIOThread : public web::WebThreadDelegate {
net_log::ChromeNetLog* net_log_;
// These member variables are basically global, but their lifetimes are tied
- // to the IOSChromeIOThread. IOSChromeIOThread owns them all, despite not
- // using scoped_ptr. This is because the destructor of IOSChromeIOThread runs
- // on the wrong thread. All member variables should be deleted in CleanUp().
+ // to the IOSIOThread. IOSIOThread owns them all, despite not using
+ // scoped_ptr. This is because the destructor of IOSIOThread runs on the
+ // wrong thread. All member variables should be deleted in CleanUp().
// These member variables are initialized in Init() and do not change for the
// lifetime of the IO thread.
@@ -216,7 +229,7 @@ class IOSChromeIOThread : public web::WebThreadDelegate {
ssl_config_service_manager_;
// These member variables are initialized by a task posted to the IO thread,
- // which gets posted by calling certain member functions of IOSChromeIOThread.
+ // which gets posted by calling certain member functions of IOSIOThread.
std::unique_ptr<net::ProxyConfigService> system_proxy_config_service_;
std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
@@ -226,9 +239,11 @@ class IOSChromeIOThread : public web::WebThreadDelegate {
const base::TimeTicks creation_time_;
- base::WeakPtrFactory<IOSChromeIOThread> weak_factory_;
+ base::WeakPtrFactory<IOSIOThread> weak_factory_;
- DISALLOW_COPY_AND_ASSIGN(IOSChromeIOThread);
+ DISALLOW_COPY_AND_ASSIGN(IOSIOThread);
};
-#endif // IOS_CHROME_BROWSER_IOS_CHROME_IO_THREAD_H_
+} // namespace io_thread
+
+#endif // IOS_COMPONENTS_IO_THREAD_IO_THREAD_H_
« no previous file with comments | « ios/components/io_thread/DEPS ('k') | ios/components/io_thread/ios_io_thread.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698