OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_ |
6 #define CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_ | 6 #define CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 | 13 |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
15 | 16 |
16 class PrintPreviewDataStore; | 17 class PrintPreviewDataStore; |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 template <typename T> | 20 template <typename T> |
20 struct DefaultSingletonTraits; | 21 struct DefaultSingletonTraits; |
(...skipping 29 matching lines...) Expand all Loading... |
50 // Returns the available draft page count. | 51 // Returns the available draft page count. |
51 int GetAvailableDraftPageCount(int32_t preview_ui_id) const; | 52 int GetAvailableDraftPageCount(int32_t preview_ui_id) const; |
52 | 53 |
53 private: | 54 private: |
54 friend struct base::DefaultSingletonTraits<PrintPreviewDataService>; | 55 friend struct base::DefaultSingletonTraits<PrintPreviewDataService>; |
55 | 56 |
56 // 1:1 relationship between PrintPreviewUI and data store object. | 57 // 1:1 relationship between PrintPreviewUI and data store object. |
57 // Key: PrintPreviewUI ID. | 58 // Key: PrintPreviewUI ID. |
58 // Value: Print preview data store object. | 59 // Value: Print preview data store object. |
59 using PreviewDataStoreMap = | 60 using PreviewDataStoreMap = |
60 std::map<int32_t, scoped_refptr<PrintPreviewDataStore>>; | 61 std::map<int32_t, std::unique_ptr<PrintPreviewDataStore>>; |
61 | 62 |
62 PrintPreviewDataService(); | 63 PrintPreviewDataService(); |
63 ~PrintPreviewDataService(); | 64 ~PrintPreviewDataService(); |
64 | 65 |
65 PreviewDataStoreMap data_store_map_; | 66 PreviewDataStoreMap data_store_map_; |
66 | 67 |
67 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDataService); | 68 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDataService); |
68 }; | 69 }; |
69 | 70 |
70 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_ | 71 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_ |
OLD | NEW |