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_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| 6 #define CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 6 #define CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | |
| 10 | |
| 9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
| 11 #include "base/time.h" | 13 #include "base/time.h" |
| 12 #include "content/renderer/render_view_observer.h" | 14 #include "content/renderer/render_view_observer.h" |
| 13 #include "content/renderer/render_view_observer_tracker.h" | 15 #include "content/renderer/render_view_observer_tracker.h" |
| 14 #include "printing/metafile.h" | 16 #include "printing/metafile.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" |
| 17 #include "ui/gfx/size.h" | 19 #include "ui/gfx/size.h" |
| 18 | 20 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 public RenderViewObserverTracker<PrintWebViewHelper>, | 72 public RenderViewObserverTracker<PrintWebViewHelper>, |
| 71 public WebKit::WebViewClient, | 73 public WebKit::WebViewClient, |
| 72 public WebKit::WebFrameClient { | 74 public WebKit::WebFrameClient { |
| 73 public: | 75 public: |
| 74 explicit PrintWebViewHelper(RenderView* render_view); | 76 explicit PrintWebViewHelper(RenderView* render_view); |
| 75 virtual ~PrintWebViewHelper(); | 77 virtual ~PrintWebViewHelper(); |
| 76 | 78 |
| 77 protected: | 79 protected: |
| 78 // WebKit::WebViewClient override: | 80 // WebKit::WebViewClient override: |
| 79 virtual void didStopLoading(); | 81 virtual void didStopLoading(); |
| 80 | |
| 81 private: | 82 private: |
| 82 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, | 83 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, |
| 83 BlockScriptInitiatedPrinting); | 84 BlockScriptInitiatedPrinting); |
| 84 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, OnPrintPages); | 85 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, OnPrintPages); |
| 85 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreview); | 86 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreview); |
| 86 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreviewFail); | 87 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreviewFail); |
| 87 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, | 88 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, |
| 88 OnPrintForPrintPreview); | 89 OnPrintForPrintPreview); |
| 89 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, | 90 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, |
| 90 OnPrintForPrintPreviewFail); | 91 OnPrintForPrintPreviewFail); |
| 91 | 92 |
| 92 #if defined(OS_WIN) || defined(OS_MACOSX) | 93 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 93 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintLayoutTest); | 94 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintLayoutTest); |
| 94 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintWithIframe); | 95 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintWithIframe); |
| 95 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 96 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 96 | 97 |
| 97 // RenderViewObserver implementation. | 98 // RenderViewObserver implementation. |
| 98 virtual bool OnMessageReceived(const IPC::Message& message); | 99 virtual bool OnMessageReceived(const IPC::Message& message); |
| 99 virtual void PrintPage(WebKit::WebFrame* frame); | 100 virtual void PrintPage(WebKit::WebFrame* frame); |
| 100 | 101 |
| 101 // Message handlers --------------------------------------------------------- | 102 // Message handlers --------------------------------------------------------- |
| 102 | 103 |
| 104 // Setup or teardown a whitelist allowing the | |
|
Lei Zhang
2011/06/14 01:08:08
Remove?
Albert Bodenhamer
2011/06/14 19:43:54
Done.
| |
| 105 // print preview page to communicate with cloud print. | |
| 106 void OnPrintSetupWhitelist(std::string host); | |
| 107 void OnPrintTeardownWhitelist(std::string host); | |
| 108 | |
| 103 // Print the document. | 109 // Print the document. |
| 104 void OnPrintPages(); | 110 void OnPrintPages(); |
| 105 | 111 |
| 106 // Initiate print preview. | 112 // Initiate print preview. |
| 107 void OnInitiatePrintPreview(); | 113 void OnInitiatePrintPreview(); |
| 108 | 114 |
| 109 // Generate a print preview using |settings|. | 115 // Generate a print preview using |settings|. |
| 110 void OnPrintPreview(const DictionaryValue& settings); | 116 void OnPrintPreview(const DictionaryValue& settings); |
| 111 | 117 |
| 112 // Print / preview the node under the context menu. | 118 // Print / preview the node under the context menu. |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 int user_cancelled_scripted_print_count_; | 276 int user_cancelled_scripted_print_count_; |
| 271 | 277 |
| 272 // Let the browser process know of a printing failure. Only set to false when | 278 // Let the browser process know of a printing failure. Only set to false when |
| 273 // the failure came from the browser in the first place. | 279 // the failure came from the browser in the first place. |
| 274 bool notify_browser_of_print_failure_; | 280 bool notify_browser_of_print_failure_; |
| 275 | 281 |
| 276 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 282 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 277 }; | 283 }; |
| 278 | 284 |
| 279 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 285 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| OLD | NEW |