| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_RENDERER_HOST_CHROME_NAVIGATION_DATA_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_NAVIGATION_DATA_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/supports_user_data.h" |
| 12 #include "content/public/browser/navigation_data.h" |
| 13 |
| 14 namespace data_reduction_proxy { |
| 15 class DataReductionProxyData; |
| 16 } |
| 17 |
| 18 namespace net { |
| 19 class URLRequest; |
| 20 } |
| 21 |
| 22 class ChromeNavigationData : public content::NavigationData, |
| 23 public base::SupportsUserData::Data { |
| 24 public: |
| 25 ChromeNavigationData(); |
| 26 ~ChromeNavigationData() override; |
| 27 |
| 28 // Creates a new ChromeNavigationData that is a deep copy of the original. Any |
| 29 // changes to the original after the clone is created will not be reflected in |
| 30 // the clone. |
| 31 // |data_reduction_proxy_data_| is deep copied. |
| 32 std::unique_ptr<content::NavigationData> Clone() const override; |
| 33 |
| 34 // Takes ownership of |data_reduction_proxy_data|. |
| 35 void SetDataReductionProxyData( |
| 36 std::unique_ptr<data_reduction_proxy::DataReductionProxyData> |
| 37 data_reduction_proxy_data) { |
| 38 data_reduction_proxy_data_ = std::move(data_reduction_proxy_data); |
| 39 } |
| 40 |
| 41 data_reduction_proxy::DataReductionProxyData* GetDataReductionProxyData() |
| 42 const { |
| 43 return data_reduction_proxy_data_.get(); |
| 44 } |
| 45 |
| 46 static ChromeNavigationData* GetDataAndCreateIfNecessary( |
| 47 net::URLRequest* request); |
| 48 |
| 49 private: |
| 50 // Manages the lifetime of optional DataReductionProxy information. |
| 51 std::unique_ptr<data_reduction_proxy::DataReductionProxyData> |
| 52 data_reduction_proxy_data_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(ChromeNavigationData); |
| 55 }; |
| 56 |
| 57 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_NAVIGATION_DATA_H_ |
| OLD | NEW |