2015-10-16 20:44:00 -04: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.
|
|
|
|
|
|
|
|
#include "libcef/browser/chrome_profile_stub.h"
|
|
|
|
|
2020-03-30 16:13:42 -04:00
|
|
|
#include "components/variations/variations_client.h"
|
|
|
|
#include "components/variations/variations_http_header_provider.h"
|
2018-10-02 15:14:11 +03:00
|
|
|
#include "content/public/browser/resource_context.h"
|
|
|
|
#include "net/url_request/url_request_context.h"
|
|
|
|
|
2020-03-30 16:13:42 -04:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
class CefVariationsClient : public variations::VariationsClient {
|
|
|
|
public:
|
|
|
|
explicit CefVariationsClient(content::BrowserContext* browser_context)
|
|
|
|
: browser_context_(browser_context) {}
|
|
|
|
|
|
|
|
~CefVariationsClient() override = default;
|
|
|
|
|
|
|
|
bool IsIncognito() const override {
|
|
|
|
return browser_context_->IsOffTheRecord();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string GetVariationsHeader() const override {
|
|
|
|
return variations::VariationsHttpHeaderProvider::GetInstance()
|
|
|
|
->GetClientDataHeader(false /* is_signed_in */);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
content::BrowserContext* browser_context_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
ChromeProfileStub::ChromeProfileStub() {}
|
2015-10-16 20:44:00 -04:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
ChromeProfileStub::~ChromeProfileStub() {}
|
2015-10-16 20:44:00 -04:00
|
|
|
|
2019-09-04 15:13:32 +00:00
|
|
|
bool ChromeProfileStub::IsOffTheRecord() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ChromeProfileStub::IsOffTheRecord() const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-03-30 16:13:42 -04:00
|
|
|
variations::VariationsClient* ChromeProfileStub::GetVariationsClient() {
|
|
|
|
if (!variations_client_)
|
|
|
|
variations_client_ = std::make_unique<CefVariationsClient>(this);
|
|
|
|
return variations_client_.get();
|
|
|
|
}
|
|
|
|
|
2015-10-16 20:44:00 -04:00
|
|
|
scoped_refptr<base::SequencedTaskRunner> ChromeProfileStub::GetIOTaskRunner() {
|
2016-11-07 14:14:09 -05:00
|
|
|
NOTREACHED();
|
2015-10-16 20:44:00 -04:00
|
|
|
return scoped_refptr<base::SequencedTaskRunner>();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string ChromeProfileStub::GetProfileUserName() const {
|
2016-11-07 14:14:09 -05:00
|
|
|
NOTREACHED();
|
2015-10-16 20:44:00 -04:00
|
|
|
return std::string();
|
|
|
|
}
|
|
|
|
|
|
|
|
Profile::ProfileType ChromeProfileStub::GetProfileType() const {
|
|
|
|
return REGULAR_PROFILE;
|
|
|
|
}
|
|
|
|
|
|
|
|
Profile* ChromeProfileStub::GetOffTheRecordProfile() {
|
2016-11-07 14:14:09 -05:00
|
|
|
NOTREACHED();
|
2020-01-15 14:36:24 +01:00
|
|
|
return nullptr;
|
2015-10-16 20:44:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ChromeProfileStub::DestroyOffTheRecordProfile() {
|
2016-11-07 14:14:09 -05:00
|
|
|
NOTREACHED();
|
2015-10-16 20:44:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ChromeProfileStub::HasOffTheRecordProfile() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Profile* ChromeProfileStub::GetOriginalProfile() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-12-07 16:44:24 -05:00
|
|
|
const Profile* ChromeProfileStub::GetOriginalProfile() const {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2016-11-07 14:14:09 -05:00
|
|
|
bool ChromeProfileStub::IsSupervised() const {
|
2015-10-16 20:44:00 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-11-07 14:14:09 -05:00
|
|
|
bool ChromeProfileStub::IsChild() const {
|
2015-10-16 20:44:00 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-11-07 14:14:09 -05:00
|
|
|
bool ChromeProfileStub::IsLegacySupervised() const {
|
2015-10-16 20:44:00 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ExtensionSpecialStoragePolicy*
|
2017-05-17 11:29:28 +02:00
|
|
|
ChromeProfileStub::GetExtensionSpecialStoragePolicy() {
|
2016-11-07 14:14:09 -05:00
|
|
|
NOTREACHED();
|
2020-01-15 14:36:24 +01:00
|
|
|
return nullptr;
|
2015-10-16 20:44:00 -04:00
|
|
|
}
|
|
|
|
|
2016-11-07 14:14:09 -05:00
|
|
|
PrefService* ChromeProfileStub::GetOffTheRecordPrefs() {
|
|
|
|
NOTREACHED();
|
2020-01-15 14:36:24 +01:00
|
|
|
return nullptr;
|
2015-10-16 20:44:00 -04:00
|
|
|
}
|
|
|
|
|
2016-11-07 14:14:09 -05:00
|
|
|
bool ChromeProfileStub::IsSameProfile(Profile* profile) {
|
|
|
|
NOTREACHED();
|
2015-10-16 20:44:00 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-11-07 14:14:09 -05:00
|
|
|
base::Time ChromeProfileStub::GetStartTime() const {
|
|
|
|
NOTREACHED();
|
2015-10-16 20:44:00 -04:00
|
|
|
return base::Time();
|
|
|
|
}
|
|
|
|
|
2016-11-07 14:14:09 -05:00
|
|
|
base::FilePath ChromeProfileStub::last_selected_directory() {
|
|
|
|
NOTREACHED();
|
2015-10-16 20:44:00 -04:00
|
|
|
return base::FilePath();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChromeProfileStub::set_last_selected_directory(
|
2016-11-07 14:14:09 -05:00
|
|
|
const base::FilePath& path) {
|
|
|
|
NOTREACHED();
|
2015-10-16 20:44:00 -04:00
|
|
|
}
|
|
|
|
|
2016-11-07 14:14:09 -05:00
|
|
|
GURL ChromeProfileStub::GetHomePage() {
|
|
|
|
NOTREACHED();
|
2015-10-16 20:44:00 -04:00
|
|
|
return GURL();
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
bool ChromeProfileStub::WasCreatedByVersionOrLater(const std::string& version) {
|
2016-11-07 14:14:09 -05:00
|
|
|
NOTREACHED();
|
2015-10-16 20:44:00 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-09-04 15:13:32 +00:00
|
|
|
bool ChromeProfileStub::IsIndependentOffTheRecordProfile() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-10-16 20:44:00 -04:00
|
|
|
void ChromeProfileStub::SetExitType(ExitType exit_type) {
|
2016-11-07 14:14:09 -05:00
|
|
|
NOTREACHED();
|
2015-10-16 20:44:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Profile::ExitType ChromeProfileStub::GetLastSessionExitType() {
|
2016-11-07 14:14:09 -05:00
|
|
|
NOTREACHED();
|
2015-10-16 20:44:00 -04:00
|
|
|
return EXIT_NORMAL;
|
|
|
|
}
|
2019-10-01 13:55:16 +00:00
|
|
|
|
|
|
|
base::Time ChromeProfileStub::GetCreationTime() const {
|
|
|
|
NOTREACHED();
|
|
|
|
return base::Time();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChromeProfileStub::SetCreationTimeForTesting(base::Time creation_time) {
|
|
|
|
NOTREACHED();
|
|
|
|
}
|