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_UI_DATA_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_NAVIGATION_UI_DATA_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "content/public/browser/navigation_ui_data.h" |
| 12 #include "extensions/browser/extension_navigation_ui_data.h" |
| 13 |
| 14 namespace content { |
| 15 class NavigationHandle; |
| 16 } |
| 17 |
| 18 // PlzNavigate |
| 19 // Contains data that is passed from the UI thread to the IO thread at the |
| 20 // beginning of each navigation. The class is instantiated on the UI thread, |
| 21 // then a copy created using Clone is passed to the content::ResourceRequestInfo |
| 22 // on the IO thread. |
| 23 class ChromeNavigationUIData : public content::NavigationUIData { |
| 24 public: |
| 25 ChromeNavigationUIData(); |
| 26 explicit ChromeNavigationUIData(content::NavigationHandle* navigation_handle); |
| 27 ~ChromeNavigationUIData() override; |
| 28 |
| 29 // Creates a new ChromeNavigationUIData that is a deep copy of the original. |
| 30 // Any changes to the original after the clone is created will not be |
| 31 // reflected in the clone. |extension_data_| is deep copied. |
| 32 std::unique_ptr<content::NavigationUIData> Clone() const override; |
| 33 |
| 34 #if defined(ENABLE_EXTENSIONS) |
| 35 void SetExtensionNavigationUIData( |
| 36 std::unique_ptr<extensions::ExtensionNavigationUIData> extension_data); |
| 37 |
| 38 extensions::ExtensionNavigationUIData* GetExtensionNavigationUIData() const { |
| 39 return extension_data_.get(); |
| 40 } |
| 41 #endif |
| 42 |
| 43 private: |
| 44 #if defined(ENABLE_EXTENSIONS) |
| 45 // Manages the lifetime of optional ExtensionNavigationUIData information. |
| 46 std::unique_ptr<extensions::ExtensionNavigationUIData> extension_data_; |
| 47 #endif |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(ChromeNavigationUIData); |
| 50 }; |
| 51 |
| 52 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_NAVIGATION_UI_DATA_H_ |
OLD | NEW |