1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_PROFILES_STORAGE_PARTITION_DESCRIPTOR_H_
6 #define CHROME_BROWSER_PROFILES_STORAGE_PARTITION_DESCRIPTOR_H_
7 
8 #include "base/files/file_path.h"
9 
10 // This structure combines a StoragePartition's on-disk path and a boolean for
11 // whether the partition should be persisted on disk. Its purpose is to serve as
12 // a unique key to look up RequestContext objects in the ProfileIOData derived
13 // classes.
14 struct StoragePartitionDescriptor {
StoragePartitionDescriptorStoragePartitionDescriptor15   StoragePartitionDescriptor(const base::FilePath& partition_path,
16                              const bool in_memory_only)
17     : path(partition_path),
18       in_memory(in_memory_only) {}
19 
20   const base::FilePath path;
21   const bool in_memory;
22 };
23 
24 // Functor for operator <.
25 struct StoragePartitionDescriptorLess {
operatorStoragePartitionDescriptorLess26   bool operator()(const StoragePartitionDescriptor& lhs,
27                   const StoragePartitionDescriptor& rhs) const {
28     if (lhs.path != rhs.path)
29       return lhs.path < rhs.path;
30     else if (lhs.in_memory != rhs.in_memory)
31       return lhs.in_memory < rhs.in_memory;
32     else
33       return false;
34   }
35 };
36 
37 #endif  // CHROME_BROWSER_PROFILES_STORAGE_PARTITION_DESCRIPTOR_H_
38