15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_PROFILES_STORAGE_PARTITION_DESCRIPTOR_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_PROFILES_STORAGE_PARTITION_DESCRIPTOR_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
87d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "base/containers/hash_tables.h"
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/files/file_path.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This structure combines a StoragePartition's on-disk path and a boolean for
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// whether the partition should be persisted on disk. Its purpose is to serve as
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// a unique key to look up RequestContext objects in the ProfileIOData derived
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// classes.
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct StoragePartitionDescriptor {
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  StoragePartitionDescriptor(const base::FilePath& partition_path,
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                             const bool in_memory_only)
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    : path(partition_path),
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      in_memory(in_memory_only) {}
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  const base::FilePath path;
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const bool in_memory;
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Functor for operator <.
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct StoragePartitionDescriptorLess {
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool operator()(const StoragePartitionDescriptor& lhs,
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                  const StoragePartitionDescriptor& rhs) const {
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    if (lhs.path != rhs.path)
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      return lhs.path < rhs.path;
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    else if (lhs.in_memory != rhs.in_memory)
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      return lhs.in_memory < rhs.in_memory;
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    else
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      return false;
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_PROFILES_STORAGE_PARTITION_DESCRIPTOR_H_
39