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