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 #include "extensions/browser/extension_navigation_ui_data.h" | 5 #include "extensions/browser/extension_navigation_ui_data.h" |
6 | 6 |
7 #include "content/public/browser/navigation_handle.h" | 7 #include "content/public/browser/navigation_handle.h" |
8 | 8 |
9 namespace extensions { | 9 namespace extensions { |
10 | 10 |
11 ExtensionNavigationUIData::ExtensionNavigationUIData() {} | 11 ExtensionNavigationUIData::ExtensionNavigationUIData() |
| 12 : from_extension_(false) {} |
12 | 13 |
13 ExtensionNavigationUIData::ExtensionNavigationUIData( | 14 ExtensionNavigationUIData::ExtensionNavigationUIData( |
14 content::NavigationHandle* navigation_handle, | 15 content::NavigationHandle* navigation_handle, |
| 16 bool from_extension, |
15 int tab_id, | 17 int tab_id, |
16 int window_id) { | 18 int window_id) |
| 19 : from_extension_(from_extension) { |
17 // TODO(clamy): See if it would be possible to have just one source for the | 20 // TODO(clamy): See if it would be possible to have just one source for the |
18 // FrameData that works both for navigations and subresources loads. | 21 // FrameData that works both for navigations and subresources loads. |
19 frame_data_.frame_id = ExtensionApiFrameIdMap::GetFrameId(navigation_handle); | 22 frame_data_.frame_id = ExtensionApiFrameIdMap::GetFrameId(navigation_handle); |
20 frame_data_.parent_frame_id = | 23 frame_data_.parent_frame_id = |
21 ExtensionApiFrameIdMap::GetParentFrameId(navigation_handle); | 24 ExtensionApiFrameIdMap::GetParentFrameId(navigation_handle); |
22 frame_data_.tab_id = tab_id; | 25 frame_data_.tab_id = tab_id; |
23 frame_data_.window_id = window_id; | 26 frame_data_.window_id = window_id; |
24 } | 27 } |
25 | 28 |
26 std::unique_ptr<ExtensionNavigationUIData> ExtensionNavigationUIData::DeepCopy() | 29 std::unique_ptr<ExtensionNavigationUIData> ExtensionNavigationUIData::DeepCopy() |
27 const { | 30 const { |
28 std::unique_ptr<ExtensionNavigationUIData> copy( | 31 std::unique_ptr<ExtensionNavigationUIData> copy( |
29 new ExtensionNavigationUIData()); | 32 new ExtensionNavigationUIData()); |
| 33 copy->from_extension_ = from_extension_; |
30 copy->set_frame_data(frame_data_); | 34 copy->set_frame_data(frame_data_); |
31 return copy; | 35 return copy; |
32 } | 36 } |
33 | 37 |
34 } // namespace extensions | 38 } // namespace extensions |
OLD | NEW |