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

ash / wallpaper / sea_pen_wallpaper_manager_session_delegate_impl.cc [blame]

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/wallpaper/sea_pen_wallpaper_manager_session_delegate_impl.h"

#include <string_view>

#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/wallpaper/wallpaper_constants.h"
#include "base/files/file_path.h"
#include "components/account_id/account_id.h"

namespace ash {

namespace {

constexpr std::string_view kWallpaperDirName = "wallpaper";

}  // namespace

SeaPenWallpaperManagerSessionDelegateImpl::
    SeaPenWallpaperManagerSessionDelegateImpl() = default;

SeaPenWallpaperManagerSessionDelegateImpl::
    ~SeaPenWallpaperManagerSessionDelegateImpl() = default;

base::FilePath SeaPenWallpaperManagerSessionDelegateImpl::GetStorageDirectory(
    const AccountId& account_id) {
  const auto profile_path =
      Shell::Get()->session_controller()->GetProfilePath(account_id);
  if (profile_path.empty()) {
    LOG(WARNING) << "Empty profile path.";
    return base::FilePath();
  }
  return profile_path.Append(kWallpaperDirName)
      .Append(wallpaper_constants::kSeaPenWallpaperDirName);
}

}  // namespace ash