Commit acb27229 authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Add shorthand functions for accessing primary OffTheRecord profile.

Adds two shorthand functions to create, get, or check existence of
primary OffTheRecord profile.

Bug: 1033903, 1060940
Change-Id: Ic9ff38ea0f9961088a6d34a94ef2f7eaa2bcd9e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2130351Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757438}
parent d01185c5
......@@ -423,6 +423,14 @@ void Profile::NotifyOffTheRecordProfileCreated(Profile* off_the_record) {
observer.OnOffTheRecordProfileCreated(off_the_record);
}
Profile* Profile::GetPrimaryOTRProfile() {
return GetOffTheRecordProfile(OTRProfileID::PrimaryID());
}
bool Profile::HasPrimaryOTRProfile() {
return HasOffTheRecordProfile(OTRProfileID::PrimaryID());
}
variations::VariationsClient* Profile::GetVariationsClient() {
if (!chrome_variations_client_)
chrome_variations_client_ = std::make_unique<ChromeVariationsClient>(this);
......
......@@ -227,6 +227,10 @@ class Profile : public content::BrowserContext {
// Returns all OffTheRecord profiles.
virtual std::vector<Profile*> GetAllOffTheRecordProfiles() = 0;
// Returns the primary OffTheRecord profile. Creates the profile if it doesn't
// exist.
Profile* GetPrimaryOTRProfile();
// Destroys the OffTheRecord profile.
virtual void DestroyOffTheRecordProfile(Profile* otr_profile) = 0;
......@@ -243,6 +247,9 @@ class Profile : public content::BrowserContext {
// Returns true if the profile has any OffTheRecord profiles.
virtual bool HasAnyOffTheRecordProfile() = 0;
// True if the primary OffTheRecord profile exists.
bool HasPrimaryOTRProfile();
// Return the original "recording" profile. This method returns this if the
// profile is not OffTheRecord.
virtual Profile* GetOriginalProfile() = 0;
......
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