Commit 7c88de03 authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Remove Profile::IsSameProfileAndType().

The function is used in a very few cases and is equivalent of ==.

Bug: 1033903
Change-Id: I8339ac5a43005759c19616684eb04829afe6f551
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2218089Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#776044}
parent 5ec9b3fe
......@@ -348,7 +348,7 @@ bool ChromeAutocompleteProviderClient::IsTabOpenWithURL(
url, *input, GetTemplateURLService(), base::string16());
for (auto* browser : *BrowserList::GetInstance()) {
// Only look at same profile (and anonymity level).
if (browser->profile()->IsSameProfileAndType(profile_)) {
if (profile_ == browser->profile()) {
for (int i = 0; i < browser->tab_strip_model()->count(); ++i) {
content::WebContents* web_contents =
browser->tab_strip_model()->GetWebContentsAt(i);
......
......@@ -605,7 +605,7 @@ void MediaEngagementContentsObserver::ReadyToCommitNavigation(
content::WebContents* MediaEngagementContentsObserver::GetOpener() const {
#if !defined(OS_ANDROID)
for (auto* browser : *BrowserList::GetInstance()) {
if (!browser->profile()->IsSameProfileAndType(service_->profile()))
if (browser->profile() != service_->profile())
continue;
int index =
......
......@@ -319,11 +319,6 @@ class Profile : public content::BrowserContext {
// versa).
virtual bool IsSameProfile(Profile* profile) = 0;
// Returns whether two profiles are the same and of the same type.
bool IsSameProfileAndType(Profile* profile) {
return profile == static_cast<Profile*>(this);
}
// Returns the time the profile was started. This is not the time the profile
// was created, rather it is the time the user started chrome and logged into
// this profile. For the single profile case, this corresponds to the time
......
......@@ -1347,9 +1347,6 @@ ProfileImpl::GetNativeFileSystemPermissionContext() {
}
bool ProfileImpl::IsSameProfile(Profile* profile) {
if (IsSameProfileAndType(profile))
return true;
return profile && profile->GetOriginalProfile() == this;
}
......
......@@ -132,7 +132,7 @@ std::pair<Browser*, int> GetIndexAndBrowserOfExistingTab(
++browser_it) {
Browser* browser = *browser_it;
// When tab switching, only look at same profile and anonymity level.
if (browser->profile()->IsSameProfileAndType(profile)) {
if (profile == browser->profile()) {
int index = GetIndexOfExistingTab(browser, params);
if (index >= 0)
return {browser, index};
......
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