Chromium Code Reviews| Index: chrome/browser/dom_ui/print_preview_handler.h |
| =================================================================== |
| --- chrome/browser/dom_ui/print_preview_handler.h (revision 72691) |
| +++ chrome/browser/dom_ui/print_preview_handler.h (working copy) |
| @@ -1,4 +1,4 @@ |
| -// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| @@ -6,21 +6,38 @@ |
| #define CHROME_BROWSER_DOM_UI_PRINT_PREVIEW_HANDLER_H_ |
| #pragma once |
| -#include "base/scoped_ptr.h" |
|
James Hawkins
2011/01/31 18:39:38
This is right to remove scoped_ptr.h, but now we n
Lei Zhang
2011/01/31 22:15:51
weak_ptr.h includes ref_counted.h, but I added it
|
| +#include <utility> |
| + |
| #include "base/weak_ptr.h" |
| #include "chrome/browser/dom_ui/dom_ui.h" |
| +namespace base { |
| +class SharedMemory; |
| +} |
| + |
| namespace printing { |
| class PrintBackend; |
| -} // namespace printing |
|
James Hawkins
2011/01/31 18:39:38
I realize there was disagreement on the list recen
Lei Zhang
2011/01/31 22:15:51
I've asked for the style guide to be updated to re
|
| +} |
| // The handler for Javascript messages related to the "print preview" dialog. |
| class PrintPreviewHandler : public DOMMessageHandler, |
| public base::SupportsWeakPtr<PrintPreviewHandler> { |
| public: |
| + typedef std::pair<base::SharedMemory*, uint32> PrintPreviewData; |
|
James Hawkins
2011/01/31 18:39:38
Document this typedef.
Lei Zhang
2011/01/31 22:15:51
Done.
|
| + |
| PrintPreviewHandler(); |
| virtual ~PrintPreviewHandler(); |
| + // Get the print preview |data|. The data is valid as long as the |
|
James Hawkins
2011/01/31 18:39:38
s/Get/Gets/
Lei Zhang
2011/01/31 22:15:51
Done.
|
| + // PrintPreviewHandler is valid and SetPrintPreviewData() does not get called. |
| + void GetPrintPreviewData(PrintPreviewData* data); |
| + |
| + // Save the print preview |data|. PrintPreviewHandler owns the data and is |
|
James Hawkins
2011/01/31 18:39:38
s/Save/Saves/ and now that I look at the method na
Lei Zhang
2011/01/31 22:15:51
There's no function named "SetsFoo". Everything in
James Hawkins
2011/02/01 01:02:38
By "this", I was referring to the comment.
|
| + // responsible for freeing it when either: |
| + // a) there is new data. |
| + // b) when PrintPreviewHandler goes away. |
|
James Hawkins
2011/01/31 18:39:38
nit: You should probably be more descriptive than
Lei Zhang
2011/01/31 22:15:51
Done.
|
| + void SetPrintPreviewData(const PrintPreviewData& data); |
| + |
| // DOMMessageHandler implementation. |
| virtual void RegisterMessages(); |
| @@ -34,6 +51,9 @@ |
| // Pointer to current print system. |
| scoped_refptr<printing::PrintBackend> print_backend_; |
| + // Current print preview data, owned by PrintPreviewHandler. |
| + PrintPreviewData data_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
| }; |