Home | History | Annotate | Download | only in cloud
      1 // Copyright 2013 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 
      5 #include "base/memory/scoped_ptr.h"
      6 #include "components/policy/policy_export.h"
      7 #include "net/url_request/static_http_user_agent_settings.h"
      8 #include "net/url_request/url_request_context_getter.h"
      9 
     10 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_POLICY_REQUEST_CONTEXT_H_
     11 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_POLICY_REQUEST_CONTEXT_H_
     12 
     13 namespace net {
     14 class HttpNetworkLayer;
     15 }
     16 
     17 namespace policy {
     18 
     19 class POLICY_EXPORT UserPolicyRequestContext
     20     : public net::URLRequestContextGetter {
     21  public:
     22   UserPolicyRequestContext(
     23       scoped_refptr<net::URLRequestContextGetter> user_context_getter,
     24       scoped_refptr<net::URLRequestContextGetter> system_context_getter,
     25       const std::string& user_agent);
     26 
     27   // Overridden from net::URLRequestContextGetter:
     28   virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE;
     29   virtual scoped_refptr<base::SingleThreadTaskRunner>
     30       GetNetworkTaskRunner() const OVERRIDE;
     31 
     32  protected:
     33   virtual ~UserPolicyRequestContext();
     34 
     35  private:
     36   scoped_refptr<net::URLRequestContextGetter> user_context_getter_;
     37   scoped_refptr<net::URLRequestContextGetter> system_context_getter_;
     38 
     39   // The lazy-initialized URLRequestContext associated with this getter.
     40   scoped_ptr<net::URLRequestContext> context_;
     41 
     42   // HttpNetworkLayer associated with |context_|.
     43   scoped_ptr<net::HttpNetworkLayer> http_transaction_factory_;
     44 
     45   net::StaticHttpUserAgentSettings http_user_agent_settings_;
     46   DISALLOW_COPY_AND_ASSIGN(UserPolicyRequestContext);
     47 };
     48 
     49 }  // namespace policy
     50 
     51 #endif  // COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_POLICY_REQUEST_CONTEXT_H_
     52