1 // Copyright (c) 2015 The Chromium Embedded Framework Authors. 2 // Portions copyright (c) 2012 The Chromium Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 6 #include "libcef/browser/alloy/chrome_profile_alloy.h" 7 8 #include "base/no_destructor.h" 9 #include "components/variations/variations_client.h" 10 #include "components/variations/variations_ids_provider.h" 11 #include "net/url_request/url_request_context.h" 12 13 namespace { 14 15 class CefVariationsClient : public variations::VariationsClient { 16 public: CefVariationsClient(content::BrowserContext * browser_context)17 explicit CefVariationsClient(content::BrowserContext* browser_context) 18 : browser_context_(browser_context) {} 19 20 ~CefVariationsClient() override = default; 21 IsOffTheRecord() const22 bool IsOffTheRecord() const override { 23 return browser_context_->IsOffTheRecord(); 24 } 25 GetVariationsHeaders() const26 variations::mojom::VariationsHeadersPtr GetVariationsHeaders() 27 const override { 28 return variations::VariationsIdsProvider::GetInstance() 29 ->GetClientDataHeaders(false /* is_signed_in */); 30 } 31 32 private: 33 content::BrowserContext* browser_context_; 34 }; 35 36 } // namespace 37 ChromeProfileAlloy()38ChromeProfileAlloy::ChromeProfileAlloy() {} 39 ~ChromeProfileAlloy()40ChromeProfileAlloy::~ChromeProfileAlloy() {} 41 IsOffTheRecord()42bool ChromeProfileAlloy::IsOffTheRecord() { 43 return false; 44 } 45 IsOffTheRecord() const46bool ChromeProfileAlloy::IsOffTheRecord() const { 47 return false; 48 } 49 GetOTRProfileID() const50const Profile::OTRProfileID& ChromeProfileAlloy::GetOTRProfileID() const { 51 NOTREACHED(); 52 static base::NoDestructor<Profile::OTRProfileID> otr_profile_id( 53 "ProfileImp::NoOTRProfileID"); 54 return *otr_profile_id; 55 } 56 GetVariationsClient()57variations::VariationsClient* ChromeProfileAlloy::GetVariationsClient() { 58 if (!variations_client_) 59 variations_client_ = std::make_unique<CefVariationsClient>(this); 60 return variations_client_.get(); 61 } 62 GetIOTaskRunner()63scoped_refptr<base::SequencedTaskRunner> ChromeProfileAlloy::GetIOTaskRunner() { 64 NOTREACHED(); 65 return scoped_refptr<base::SequencedTaskRunner>(); 66 } 67 GetProfileUserName() const68std::string ChromeProfileAlloy::GetProfileUserName() const { 69 NOTREACHED(); 70 return std::string(); 71 } 72 GetOffTheRecordProfile(const Profile::OTRProfileID & otr_profile_id,bool create_if_needed)73Profile* ChromeProfileAlloy::GetOffTheRecordProfile( 74 const Profile::OTRProfileID& otr_profile_id, 75 bool create_if_needed) { 76 NOTREACHED(); 77 return nullptr; 78 } 79 GetAllOffTheRecordProfiles()80std::vector<Profile*> ChromeProfileAlloy::GetAllOffTheRecordProfiles() { 81 return {}; 82 } 83 DestroyOffTheRecordProfile(Profile * otr_profile)84void ChromeProfileAlloy::DestroyOffTheRecordProfile(Profile* otr_profile) { 85 NOTREACHED(); 86 } 87 HasOffTheRecordProfile(const Profile::OTRProfileID & otr_profile_id)88bool ChromeProfileAlloy::HasOffTheRecordProfile( 89 const Profile::OTRProfileID& otr_profile_id) { 90 return false; 91 } 92 HasAnyOffTheRecordProfile()93bool ChromeProfileAlloy::HasAnyOffTheRecordProfile() { 94 return false; 95 } 96 GetOriginalProfile()97Profile* ChromeProfileAlloy::GetOriginalProfile() { 98 return this; 99 } 100 GetOriginalProfile() const101const Profile* ChromeProfileAlloy::GetOriginalProfile() const { 102 return this; 103 } 104 IsSupervised() const105bool ChromeProfileAlloy::IsSupervised() const { 106 return false; 107 } 108 IsChild() const109bool ChromeProfileAlloy::IsChild() const { 110 return false; 111 } 112 113 ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy()114ChromeProfileAlloy::GetExtensionSpecialStoragePolicy() { 115 NOTREACHED(); 116 return nullptr; 117 } 118 GetOffTheRecordPrefs()119PrefService* ChromeProfileAlloy::GetOffTheRecordPrefs() { 120 NOTREACHED(); 121 return nullptr; 122 } 123 IsSameOrParent(Profile * profile)124bool ChromeProfileAlloy::IsSameOrParent(Profile* profile) { 125 NOTREACHED(); 126 return false; 127 } 128 GetStartTime() const129base::Time ChromeProfileAlloy::GetStartTime() const { 130 NOTREACHED(); 131 return base::Time(); 132 } 133 last_selected_directory()134base::FilePath ChromeProfileAlloy::last_selected_directory() { 135 NOTREACHED(); 136 return base::FilePath(); 137 } 138 set_last_selected_directory(const base::FilePath & path)139void ChromeProfileAlloy::set_last_selected_directory( 140 const base::FilePath& path) { 141 NOTREACHED(); 142 } 143 GetHomePage()144GURL ChromeProfileAlloy::GetHomePage() { 145 NOTREACHED(); 146 return GURL(); 147 } 148 WasCreatedByVersionOrLater(const std::string & version)149bool ChromeProfileAlloy::WasCreatedByVersionOrLater( 150 const std::string& version) { 151 NOTREACHED(); 152 return false; 153 } 154 SetExitType(ExitType exit_type)155void ChromeProfileAlloy::SetExitType(ExitType exit_type) { 156 NOTREACHED(); 157 } 158 GetLastSessionExitType() const159Profile::ExitType ChromeProfileAlloy::GetLastSessionExitType() const { 160 NOTREACHED(); 161 return EXIT_NORMAL; 162 } 163 GetCreationTime() const164base::Time ChromeProfileAlloy::GetCreationTime() const { 165 NOTREACHED(); 166 return base::Time(); 167 } 168 SetCreationTimeForTesting(base::Time creation_time)169void ChromeProfileAlloy::SetCreationTimeForTesting(base::Time creation_time) { 170 NOTREACHED(); 171 } 172 RecordMainFrameNavigation()173void ChromeProfileAlloy::RecordMainFrameNavigation() { 174 NOTREACHED(); 175 } 176 IsSignedIn()177bool ChromeProfileAlloy::IsSignedIn() { 178 NOTREACHED(); 179 return false; 180 } 181