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 "components/chooser_controller/chooser_controller.h" | 5 #include "components/chooser_controller/chooser_controller.h" |
6 | 6 |
7 #include "content/public/browser/render_frame_host.h" | 7 #include "content/public/browser/render_frame_host.h" |
| 8 #include "url/origin.h" |
8 | 9 |
9 ChooserController::ChooserController(content::RenderFrameHost* owner) | 10 ChooserController::ChooserController(content::RenderFrameHost* owner) |
10 : owning_frame_(owner) {} | 11 : owning_frame_(owner) {} |
11 | 12 |
12 ChooserController::~ChooserController() {} | 13 ChooserController::~ChooserController() {} |
13 | 14 |
14 url::Origin ChooserController::GetOrigin() const { | 15 url::Origin ChooserController::GetOrigin() const { |
15 return const_cast<content::RenderFrameHost*>(owning_frame_) | 16 return owning_frame_ ? owning_frame_->GetLastCommittedOrigin() |
16 ->GetLastCommittedOrigin(); | 17 : url::Origin(); |
17 } | 18 } |
OLD | NEW |