Commit dd626f58 authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Inlined two GetProfileFromWebContents helpers

In jumbo build experiments (no jumbo for chromium/browser/ui yet)
two GetProfileFromWebContents ended up in the same translation unit.
Each of them was only used once. This inlines them both.

I dropped the null check from the GetProfileFromWebContents() in
account_chooser_dialog_view.cc because if that helper returned
null, then the code would already crash inside
GetDefaultStoragePartition() (GetStoragePartitionFromConfig()
will call browser_context->IsOffTheRecord() without any null check).

Bug: 803406
Change-Id: I0200eb42c0a54b674eaec6122e1193c931dd2344
Reviewed-on: https://chromium-review.googlesource.com/997793Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#548711}
parent ff42d47f
......@@ -39,12 +39,6 @@ namespace metrics_util = password_manager::metrics_util;
namespace {
Profile* GetProfileFromWebContents(content::WebContents* web_contents) {
if (!web_contents)
return nullptr;
return Profile::FromBrowserContext(web_contents->GetBrowserContext());
}
void CleanStatisticsForSite(Profile* profile, const GURL& origin) {
DCHECK(profile);
password_manager::PasswordStore* password_store =
......@@ -456,7 +450,10 @@ void ManagePasswordsBubbleModel::OnSkipSignInClicked() {
}
Profile* ManagePasswordsBubbleModel::GetProfile() const {
return GetProfileFromWebContents(GetWebContents());
content::WebContents* web_contents = GetWebContents();
if (!web_contents)
return nullptr;
return Profile::FromBrowserContext(web_contents->GetBrowserContext());
}
content::WebContents* ManagePasswordsBubbleModel::GetWebContents() const {
......
......@@ -46,12 +46,6 @@ views::StyledLabel::RangeStyleInfo GetLinkStyle() {
return result;
}
Profile* GetProfileFromWebContents(content::WebContents* web_contents) {
if (!web_contents)
return nullptr;
return Profile::FromBrowserContext(web_contents->GetBrowserContext());
}
// Creates a list view of credentials in |forms|.
views::ScrollView* CreateCredentialsView(
const PasswordDialogController::FormsVector& forms,
......@@ -192,10 +186,10 @@ void AccountChooserDialogView::ButtonPressed(views::Button* sender,
void AccountChooserDialogView::InitWindow() {
SetLayoutManager(std::make_unique<views::FillLayout>());
AddChildView(
CreateCredentialsView(controller_->GetLocalForms(), this,
AddChildView(CreateCredentialsView(
controller_->GetLocalForms(), this,
content::BrowserContext::GetDefaultStoragePartition(
GetProfileFromWebContents(web_contents_))
Profile::FromBrowserContext(web_contents_->GetBrowserContext()))
->GetURLLoaderFactoryForBrowserProcess()
.get()));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment