blob: 6d389075eece244b5f098fa90538d0375b9bbb6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// 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 "chrome/browser/profiles/profile.h"
#include "components/profile_metrics/browser_profile_type.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
// static
Profile* Profile::FromBrowserContext(content::BrowserContext* browser_context) {
// This is safe; this is the only implementation of the browser context.
return static_cast<Profile*>(browser_context);
}
// static
Profile* Profile::FromWebUI(content::WebUI* web_ui) {
return FromBrowserContext(web_ui->GetWebContents()->GetBrowserContext());
}
Profile* Profile::GetOriginalProfile() {
return this;
}
const Profile* Profile::GetOriginalProfile() const {
return this;
}
bool Profile::IsRegularProfile() const {
return profile_metrics::GetBrowserProfileType(this) ==
profile_metrics::BrowserProfileType::kRegular;
}
bool Profile::IsIncognitoProfile() const {
return profile_metrics::GetBrowserProfileType(this) ==
profile_metrics::BrowserProfileType::kIncognito;
}
bool Profile::IsGuestSession() const {
return profile_metrics::GetBrowserProfileType(this) ==
profile_metrics::BrowserProfileType::kGuest;
}
bool Profile::IsSystemProfile() const {
return profile_metrics::GetBrowserProfileType(this) ==
profile_metrics::BrowserProfileType::kSystem;
}
#ifdef TOOLKIT_QT
std::string Profile::GetPushMessagingEndpoint() const {
return "";
}
#endif
|