Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: components/chooser_controller/chooser_controller.cc

Issue 2086663003: Change ChooserController ownership model (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build errors Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 if (!owning_frame_)
16 ->GetLastCommittedOrigin(); 17 return url::Origin();
18 else {
19 return const_cast<content::RenderFrameHost*>(owning_frame_)
20 ->GetLastCommittedOrigin();
21 }
Reilly Grant (use Gerrit) 2016/06/21 23:47:45 Make owning_frame_ non-const to avoid this cast. T
juncai 2016/06/22 01:17:45 Done.
17 } 22 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698