--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
https://groups.google.com/a/chromium.org/group/chromium-os-dev
We probably could not use ProfileHelper from within //components since it is in //chrome/browser, which is supposed to be a higer layer of //components.//components/variation should probably be in a pretty low level layer and could only depend on //base. In this case, base::DIR_HOME is probably the best we could use. It would be overridden upon the primary user sign-in in UserSessionManager::OverrideHomedir. Not sure how to get "/home/chronos" though since that is chrome::DIR_USER_DADTA but it is a chrome path.So maybe something like:base::FilePath path = base::CheckedGet(base::DIR_HOME);if (path == base::FilePath("/")) {// Fallback to /home/chronos if DIR_HOME is not overridden and// no user has signed in.path = base::FilePath("/home/chronos");}path = path.Append(kCrashFilePath);On Tue, Apr 20, 2021 at 12:48 PM Miriam Zimmerman <mute...@google.com> wrote:Unfortunately, it looks like I'm having a circular dependency issue, because I'm doing this in //components/variations:variations, which is already indirectly depended on by the targets that include profile_helper.h (AFAICT).Is there any way around this, or am I out of luck with using this API?MiriamOn Tue, Apr 20, 2021 at 12:14 PM Miriam Zimmerman <mute...@google.com> wrote:MiriamOn Tue, Apr 20, 2021 at 12:07 PM Xiyuan Xia <xiy...@google.com> wrote:> ProfileManager::GetActiveUserProfile check-failsDo you have a crash stack? Think it should fallback to the sign-in profile when there is no active user (code).I didn't; that was based on reading the code-- but now that I read it again I think you're right, and the crash was actually elsewhere.But personally, I would avoid using ProfileManager::GetActiveUserProfile() because I don't know exactly what is returned. If the code is in chrome browser, the way James suggested should work:e.g.base::FilePath path;if (user_manager::UserManager::Get()->IsUserLoggedIn()) {path = ProfileHelper::Get()->GetActiveUserProfileDir();} else {path = ProfileHelper::GetSigninProfileDir();}path = path.Append(kCrashFilePath);Thanks! I'll give this a shot now :)On Tue, Apr 20, 2021 at 11:25 AM Miriam Zimmerman <mute...@google.com> wrote:On Mon, Apr 19, 2021 at 1:15 PM James Cook <jame...@google.com> wrote:-lists because I'm not so sure this is the right answer....Maybe some combination of ProfileHelper::GetSigninProfileDir vs. GetActiveUserProfileDir vs. user_manager::UserManager to check signin state?If that's not right, xiyuan@ might know.
--