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 #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" | |
6 | |
7 #include "base/memory/ptr_util.h" | |
8 #include "chrome/browser/sessions/session_tab_helper.h" | |
9 #include "content/public/browser/navigation_handle.h" | |
10 | |
11 ChromeNavigationUIData::ChromeNavigationUIData() {} | |
12 | |
13 ChromeNavigationUIData::ChromeNavigationUIData( | |
14 content::NavigationHandle* navigation_handle) { | |
15 #if defined(ENABLE_EXTENSIONS) | |
16 SessionTabHelper* session_tab_helper = | |
17 SessionTabHelper::FromWebContents(navigation_handle->GetWebContents()); | |
18 int tab_id = session_tab_helper ? session_tab_helper->session_id().id() : -1; | |
sky
2016/09/26 16:45:47
Is there a define for the -1 you can use?
clamy
2016/09/27 14:57:52
Unfortunately, there doesn't seem to be. Eventuall
| |
19 int window_id = | |
20 session_tab_helper ? session_tab_helper->window_id().id() : -1; | |
21 extension_data_ = base::MakeUnique<extensions::ExtensionNavigationUIData>( | |
22 navigation_handle, tab_id, window_id); | |
23 #endif | |
24 } | |
25 | |
26 ChromeNavigationUIData::~ChromeNavigationUIData() {} | |
27 | |
28 std::unique_ptr<content::NavigationUIData> ChromeNavigationUIData::Clone() | |
29 const { | |
30 std::unique_ptr<ChromeNavigationUIData> copy(new ChromeNavigationUIData()); | |
sky
2016/09/26 16:45:47
MakeUnique.
clamy
2016/09/27 14:57:52
Done.
| |
31 | |
32 #if defined(ENABLE_EXTENSIONS) | |
33 if (extension_data_) | |
34 copy->SetExtensionNavigationUIData(extension_data_->DeepCopy()); | |
35 #endif | |
36 | |
37 return std::move(copy); | |
38 } | |
OLD | NEW |