Skip to content

Commit

Permalink
Update ChromeWebContentsHandler to check Browser creation possibility.
Browse files Browse the repository at this point in the history
ChromeWebContentsHandler::OpenURLFromTab can request Browser creation
when that is not possible, and assume it's done.
This is now handled by returning NULL when Browser can not be created.

Bug: 1162795
Change-Id: I522c7754184fc47fedc202f25cb7311c33880372
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2609131
Reviewed-by: Denis Kuznetsov [CET] <antrim@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#849209}
  • Loading branch information
Ramin Halavati authored and Chromium LUCI CQ committed Feb 1, 2021
1 parent af5ff46 commit 7b341e0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion chrome/browser/ui/webui/chrome_web_contents_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ WebContents* ChromeWebContentsHandler::OpenURLFromTab(
WebContents* source,
const OpenURLParams& params) {
if (!context)
return NULL;
return nullptr;

Profile* profile = Profile::FromBrowserContext(context);

Browser* browser = chrome::FindTabbedBrowser(profile, false);
const bool browser_created = !browser;
if (!browser) {
if (Browser::GetCreationStatusForProfile(profile) !=
Browser::CreationStatus::kOk) {
return nullptr;
}
// TODO(erg): OpenURLParams should pass a user_gesture flag, pass it to
// CreateParams, and pass the real value to nav_params below.
browser = Browser::Create(
Expand Down

0 comments on commit 7b341e0

Please sign in to comment.