| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 PRINTING_PRINTED_DOCUMENT_H_ | 5 #ifndef PRINTING_PRINTED_DOCUMENT_H_ |
| 6 #define PRINTING_PRINTED_DOCUMENT_H_ | 6 #define PRINTING_PRINTED_DOCUMENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "app/gfx/native_widget_types.h" | 10 #include "app/gfx/native_widget_types.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // will have write access. Sensible functions are protected by a lock. | 32 // will have write access. Sensible functions are protected by a lock. |
| 33 // Warning: Once a page is loaded, it cannot be replaced. Pages may be discarded | 33 // Warning: Once a page is loaded, it cannot be replaced. Pages may be discarded |
| 34 // under low memory conditions. | 34 // under low memory conditions. |
| 35 class PrintedDocument : public base::RefCountedThreadSafe<PrintedDocument> { | 35 class PrintedDocument : public base::RefCountedThreadSafe<PrintedDocument> { |
| 36 public: | 36 public: |
| 37 // The cookie shall be unique and has a specific relationship with its | 37 // The cookie shall be unique and has a specific relationship with its |
| 38 // originating source and settings. | 38 // originating source and settings. |
| 39 PrintedDocument(const PrintSettings& settings, | 39 PrintedDocument(const PrintSettings& settings, |
| 40 PrintedPagesSource* source, | 40 PrintedPagesSource* source, |
| 41 int cookie); | 41 int cookie); |
| 42 ~PrintedDocument(); | |
| 43 | 42 |
| 44 // Sets a page's data. 0-based. Takes metafile ownership. | 43 // Sets a page's data. 0-based. Takes metafile ownership. |
| 45 // Note: locks for a short amount of time. | 44 // Note: locks for a short amount of time. |
| 46 void SetPage(int page_number, NativeMetafile* metafile, double shrink); | 45 void SetPage(int page_number, NativeMetafile* metafile, double shrink); |
| 47 | 46 |
| 48 // Retrieves a page. If the page is not available right now, it | 47 // Retrieves a page. If the page is not available right now, it |
| 49 // requests to have this page be rendered and returns false. | 48 // requests to have this page be rendered and returns false. |
| 50 // Note: locks for a short amount of time. | 49 // Note: locks for a short amount of time. |
| 51 bool GetPage(int page_number, scoped_refptr<PrintedPage>* page); | 50 bool GetPage(int page_number, scoped_refptr<PrintedPage>* page); |
| 52 | 51 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 const std::wstring& time() const { return immutable_.time_; } | 98 const std::wstring& time() const { return immutable_.time_; } |
| 100 const int cookie() const { return immutable_.cookie_; } | 99 const int cookie() const { return immutable_.cookie_; } |
| 101 | 100 |
| 102 // Sets a path where to dump printing output files for debugging. If never set | 101 // Sets a path where to dump printing output files for debugging. If never set |
| 103 // no files are generated. | 102 // no files are generated. |
| 104 static void set_debug_dump_path(const std::wstring& debug_dump_path); | 103 static void set_debug_dump_path(const std::wstring& debug_dump_path); |
| 105 | 104 |
| 106 static const std::wstring& debug_dump_path(); | 105 static const std::wstring& debug_dump_path(); |
| 107 | 106 |
| 108 private: | 107 private: |
| 108 friend class base::RefCountedThreadSafe<PrintedDocument>; |
| 109 |
| 110 ~PrintedDocument(); |
| 111 |
| 109 // Array of data for each print previewed page. | 112 // Array of data for each print previewed page. |
| 110 typedef std::map<int, scoped_refptr<PrintedPage> > PrintedPages; | 113 typedef std::map<int, scoped_refptr<PrintedPage> > PrintedPages; |
| 111 | 114 |
| 112 // Contains all the mutable stuff. All this stuff MUST be accessed with the | 115 // Contains all the mutable stuff. All this stuff MUST be accessed with the |
| 113 // lock held. | 116 // lock held. |
| 114 struct Mutable { | 117 struct Mutable { |
| 115 Mutable(PrintedPagesSource* source); | 118 Mutable(PrintedPagesSource* source); |
| 116 | 119 |
| 117 // Source that generates the PrintedPage's (i.e. a TabContents). It will be | 120 // Source that generates the PrintedPage's (i.e. a TabContents). It will be |
| 118 // set back to NULL if the source is deleted before this object. | 121 // set back to NULL if the source is deleted before this object. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 189 |
| 187 // All the immutable members. | 190 // All the immutable members. |
| 188 const Immutable immutable_; | 191 const Immutable immutable_; |
| 189 | 192 |
| 190 DISALLOW_EVIL_CONSTRUCTORS(PrintedDocument); | 193 DISALLOW_EVIL_CONSTRUCTORS(PrintedDocument); |
| 191 }; | 194 }; |
| 192 | 195 |
| 193 } // namespace printing | 196 } // namespace printing |
| 194 | 197 |
| 195 #endif // PRINTING_PRINTED_DOCUMENT_H_ | 198 #endif // PRINTING_PRINTED_DOCUMENT_H_ |
| OLD | NEW |