| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // or |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to represent complete | 33 // or |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to represent complete |
| 34 // preview data. Use |index| to set/update a specific preview page data. | 34 // preview data. Use |index| to set/update a specific preview page data. |
| 35 // NOTE: PrintPreviewDataStore owns the data. Do not refcount |data| before | 35 // NOTE: PrintPreviewDataStore owns the data. Do not refcount |data| before |
| 36 // calling this function. It will be refcounted in PrintPreviewDataStore. | 36 // calling this function. It will be refcounted in PrintPreviewDataStore. |
| 37 void SetDataEntry(const std::string& preview_ui_addr_str, int index, | 37 void SetDataEntry(const std::string& preview_ui_addr_str, int index, |
| 38 const RefCountedBytes* data); | 38 const RefCountedBytes* data); |
| 39 | 39 |
| 40 // Remove the corresponding PrintPreviewUI entry from the map. | 40 // Remove the corresponding PrintPreviewUI entry from the map. |
| 41 void RemoveEntry(const std::string& preview_ui_addr_str); | 41 void RemoveEntry(const std::string& preview_ui_addr_str); |
| 42 | 42 |
| 43 // Returns the available draft page count. |
| 44 int GetAvailableDraftPageCount(const std::string& preview_ui_addr_str); |
| 45 |
| 43 private: | 46 private: |
| 44 friend struct DefaultSingletonTraits<PrintPreviewDataService>; | 47 friend struct DefaultSingletonTraits<PrintPreviewDataService>; |
| 45 | 48 |
| 46 // 1:1 relationship between PrintPreviewUI and data store object. | 49 // 1:1 relationship between PrintPreviewUI and data store object. |
| 47 // Key: Print preview UI address string. | 50 // Key: Print preview UI address string. |
| 48 // Value: Print preview data store object. | 51 // Value: Print preview data store object. |
| 49 typedef std::map<std::string, scoped_refptr<PrintPreviewDataStore> > | 52 typedef std::map<std::string, scoped_refptr<PrintPreviewDataStore> > |
| 50 PreviewDataStoreMap; | 53 PreviewDataStoreMap; |
| 51 | 54 |
| 52 PrintPreviewDataService(); | 55 PrintPreviewDataService(); |
| 53 virtual ~PrintPreviewDataService(); | 56 virtual ~PrintPreviewDataService(); |
| 54 | 57 |
| 55 PreviewDataStoreMap data_store_map_; | 58 PreviewDataStoreMap data_store_map_; |
| 56 | 59 |
| 57 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDataService); | 60 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDataService); |
| 58 }; | 61 }; |
| 59 | 62 |
| 60 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_ | 63 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_ |
| OLD | NEW |