Index: chrome/browser/renderer_host/chrome_navigation_ui_data.cc |
diff --git a/chrome/browser/renderer_host/chrome_navigation_ui_data.cc b/chrome/browser/renderer_host/chrome_navigation_ui_data.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b0082fcb6a76c490df0e519072283b4c60b51f6d |
--- /dev/null |
+++ b/chrome/browser/renderer_host/chrome_navigation_ui_data.cc |
@@ -0,0 +1,38 @@ |
+// Copyright 2016 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. |
+ |
+#include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" |
+ |
+#include "base/memory/ptr_util.h" |
+#include "chrome/browser/sessions/session_tab_helper.h" |
+#include "content/public/browser/navigation_handle.h" |
+ |
+ChromeNavigationUIData::ChromeNavigationUIData() {} |
+ |
+ChromeNavigationUIData::ChromeNavigationUIData( |
+ content::NavigationHandle* navigation_handle) { |
+#if defined(ENABLE_EXTENSIONS) |
+ SessionTabHelper* session_tab_helper = |
+ SessionTabHelper::FromWebContents(navigation_handle->GetWebContents()); |
+ int tab_id = session_tab_helper ? session_tab_helper->session_id().id() : -1; |
+ int window_id = |
+ session_tab_helper ? session_tab_helper->window_id().id() : -1; |
+ extension_data_ = base::MakeUnique<extensions::ExtensionNavigationUIData>( |
+ navigation_handle, tab_id, window_id); |
+#endif |
+} |
+ |
+ChromeNavigationUIData::~ChromeNavigationUIData() {} |
+ |
+std::unique_ptr<content::NavigationUIData> ChromeNavigationUIData::Clone() |
+ const { |
+ std::unique_ptr<ChromeNavigationUIData> copy(new ChromeNavigationUIData()); |
+ |
+#if defined(ENABLE_EXTENSIONS) |
+ if (extension_data_) |
+ copy->SetExtensionNavigationUIData(extension_data_->DeepCopy()); |
+#endif |
+ |
+ return std::move(copy); |
+} |