2015-10-17 02:44:00 +02:00
|
|
|
// Copyright (c) 2015 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions copyright (c) 2012 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
#include "libcef/browser/alloy/chrome_profile_alloy.h"
|
2015-10-17 02:44:00 +02:00
|
|
|
|
2020-08-29 00:39:23 +02:00
|
|
|
#include "base/no_destructor.h"
|
2021-06-04 03:34:56 +02:00
|
|
|
#include "components/profile_metrics/browser_profile_type.h"
|
2020-03-30 22:13:42 +02:00
|
|
|
#include "components/variations/variations_client.h"
|
2020-08-29 00:39:23 +02:00
|
|
|
#include "components/variations/variations_ids_provider.h"
|
2018-10-02 14:14:11 +02:00
|
|
|
#include "net/url_request/url_request_context.h"
|
|
|
|
|
2020-03-30 22:13:42 +02:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
class CefVariationsClient : public variations::VariationsClient {
|
|
|
|
public:
|
|
|
|
explicit CefVariationsClient(content::BrowserContext* browser_context)
|
|
|
|
: browser_context_(browser_context) {}
|
|
|
|
|
|
|
|
~CefVariationsClient() override = default;
|
|
|
|
|
2020-07-08 19:23:29 +02:00
|
|
|
bool IsOffTheRecord() const override {
|
2020-03-30 22:13:42 +02:00
|
|
|
return browser_context_->IsOffTheRecord();
|
|
|
|
}
|
|
|
|
|
2020-10-08 21:54:42 +02:00
|
|
|
variations::mojom::VariationsHeadersPtr GetVariationsHeaders()
|
|
|
|
const override {
|
2020-08-29 00:39:23 +02:00
|
|
|
return variations::VariationsIdsProvider::GetInstance()
|
2020-10-08 21:54:42 +02:00
|
|
|
->GetClientDataHeaders(false /* is_signed_in */);
|
2020-03-30 22:13:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
content::BrowserContext* browser_context_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2021-06-04 03:34:56 +02:00
|
|
|
ChromeProfileAlloy::ChromeProfileAlloy() {
|
|
|
|
profile_metrics::SetBrowserProfileType(
|
|
|
|
this, profile_metrics::BrowserProfileType::kRegular);
|
|
|
|
}
|
2015-10-17 02:44:00 +02:00
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
ChromeProfileAlloy::~ChromeProfileAlloy() {}
|
2015-10-17 02:44:00 +02:00
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
bool ChromeProfileAlloy::IsOffTheRecord() {
|
2019-09-04 17:13:32 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
bool ChromeProfileAlloy::IsOffTheRecord() const {
|
2021-06-04 03:34:56 +02:00
|
|
|
// Alloy contexts are never flagged as off-the-record. It causes problems
|
|
|
|
// for the extension system.
|
2019-09-04 17:13:32 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
const Profile::OTRProfileID& ChromeProfileAlloy::GetOTRProfileID() const {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2020-06-09 19:48:00 +02:00
|
|
|
static base::NoDestructor<Profile::OTRProfileID> otr_profile_id(
|
2021-06-04 03:34:56 +02:00
|
|
|
Profile::OTRProfileID::PrimaryID());
|
2020-06-09 19:48:00 +02:00
|
|
|
return *otr_profile_id;
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
variations::VariationsClient* ChromeProfileAlloy::GetVariationsClient() {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!variations_client_) {
|
2020-03-30 22:13:42 +02:00
|
|
|
variations_client_ = std::make_unique<CefVariationsClient>(this);
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2020-03-30 22:13:42 +02:00
|
|
|
return variations_client_.get();
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
scoped_refptr<base::SequencedTaskRunner> ChromeProfileAlloy::GetIOTaskRunner() {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2015-10-17 02:44:00 +02:00
|
|
|
return scoped_refptr<base::SequencedTaskRunner>();
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
std::string ChromeProfileAlloy::GetProfileUserName() const {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2015-10-17 02:44:00 +02:00
|
|
|
return std::string();
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
Profile* ChromeProfileAlloy::GetOffTheRecordProfile(
|
2021-04-21 00:52:34 +02:00
|
|
|
const Profile::OTRProfileID& otr_profile_id,
|
|
|
|
bool create_if_needed) {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2020-01-15 14:36:24 +01:00
|
|
|
return nullptr;
|
2015-10-17 02:44:00 +02:00
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
std::vector<Profile*> ChromeProfileAlloy::GetAllOffTheRecordProfiles() {
|
2020-06-09 19:48:00 +02:00
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
void ChromeProfileAlloy::DestroyOffTheRecordProfile(Profile* otr_profile) {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2015-10-17 02:44:00 +02:00
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
bool ChromeProfileAlloy::HasOffTheRecordProfile(
|
2020-06-09 19:48:00 +02:00
|
|
|
const Profile::OTRProfileID& otr_profile_id) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
bool ChromeProfileAlloy::HasAnyOffTheRecordProfile() {
|
2015-10-17 02:44:00 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
Profile* ChromeProfileAlloy::GetOriginalProfile() {
|
2015-10-17 02:44:00 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
const Profile* ChromeProfileAlloy::GetOriginalProfile() const {
|
2017-12-07 22:44:24 +01:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
bool ChromeProfileAlloy::IsChild() const {
|
2015-10-17 02:44:00 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ExtensionSpecialStoragePolicy*
|
2020-06-28 20:29:44 +02:00
|
|
|
ChromeProfileAlloy::GetExtensionSpecialStoragePolicy() {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2020-01-15 14:36:24 +01:00
|
|
|
return nullptr;
|
2015-10-17 02:44:00 +02:00
|
|
|
}
|
|
|
|
|
2020-07-08 19:23:29 +02:00
|
|
|
bool ChromeProfileAlloy::IsSameOrParent(Profile* profile) {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2015-10-17 02:44:00 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
base::Time ChromeProfileAlloy::GetStartTime() const {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2015-10-17 02:44:00 +02:00
|
|
|
return base::Time();
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
base::FilePath ChromeProfileAlloy::last_selected_directory() {
|
2022-04-15 21:55:23 +02:00
|
|
|
return last_selected_directory_;
|
2015-10-17 02:44:00 +02:00
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
void ChromeProfileAlloy::set_last_selected_directory(
|
2016-11-07 20:14:09 +01:00
|
|
|
const base::FilePath& path) {
|
2022-04-15 21:55:23 +02:00
|
|
|
last_selected_directory_ = path;
|
2015-10-17 02:44:00 +02:00
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
GURL ChromeProfileAlloy::GetHomePage() {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2015-10-17 02:44:00 +02:00
|
|
|
return GURL();
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
bool ChromeProfileAlloy::WasCreatedByVersionOrLater(
|
|
|
|
const std::string& version) {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2015-10-17 02:44:00 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
base::Time ChromeProfileAlloy::GetCreationTime() const {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2019-10-01 15:55:16 +02:00
|
|
|
return base::Time();
|
|
|
|
}
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
void ChromeProfileAlloy::SetCreationTimeForTesting(base::Time creation_time) {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2019-10-01 15:55:16 +02:00
|
|
|
}
|
2020-10-08 21:54:42 +02:00
|
|
|
|
2021-09-20 11:06:23 +02:00
|
|
|
void ChromeProfileAlloy::RecordPrimaryMainFrameNavigation() {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2020-10-08 21:54:42 +02:00
|
|
|
}
|
2021-01-28 00:13:12 +01:00
|
|
|
|
|
|
|
bool ChromeProfileAlloy::IsSignedIn() {
|
2023-05-08 17:07:57 +02:00
|
|
|
DCHECK(false);
|
2021-01-28 00:13:12 +01:00
|
|
|
return false;
|
|
|
|
}
|