Chromium Code Reviews| 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 true if all the individual preview pages are available. | |
| 44 bool IsDraftPagesAvailable(const std::string& preview_ui_addr_str, | |
|
vandebo (ex-Chrome)
2011/08/29 18:21:56
This API is pretty fragile, you only get the right
kmadhusu
2011/08/30 17:27:00
Done.
| |
| 45 int draft_page_count); | |
| 46 | |
| 43 private: | 47 private: |
| 44 friend struct DefaultSingletonTraits<PrintPreviewDataService>; | 48 friend struct DefaultSingletonTraits<PrintPreviewDataService>; |
| 45 | 49 |
| 46 // 1:1 relationship between PrintPreviewUI and data store object. | 50 // 1:1 relationship between PrintPreviewUI and data store object. |
| 47 // Key: Print preview UI address string. | 51 // Key: Print preview UI address string. |
| 48 // Value: Print preview data store object. | 52 // Value: Print preview data store object. |
| 49 typedef std::map<std::string, scoped_refptr<PrintPreviewDataStore> > | 53 typedef std::map<std::string, scoped_refptr<PrintPreviewDataStore> > |
| 50 PreviewDataStoreMap; | 54 PreviewDataStoreMap; |
| 51 | 55 |
| 52 PrintPreviewDataService(); | 56 PrintPreviewDataService(); |
| 53 virtual ~PrintPreviewDataService(); | 57 virtual ~PrintPreviewDataService(); |
| 54 | 58 |
| 55 PreviewDataStoreMap data_store_map_; | 59 PreviewDataStoreMap data_store_map_; |
| 56 | 60 |
| 57 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDataService); | 61 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDataService); |
| 58 }; | 62 }; |
| 59 | 63 |
| 60 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_ | 64 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_ |
| OLD | NEW |