Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(634)

Side by Side Diff: chrome/renderer/chrome_render_frame_observer.cc

Issue 1556463003: Mark printing code as basic printing and/or print preview code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "chrome/renderer/chrome_render_frame_observer.h" 5 #include "chrome/renderer/chrome_render_frame_observer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "chrome/common/chrome_isolated_world_ids.h" 17 #include "chrome/common/chrome_isolated_world_ids.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/crash_keys.h" 19 #include "chrome/common/crash_keys.h"
20 #include "chrome/common/prerender_messages.h" 20 #include "chrome/common/prerender_messages.h"
21 #include "chrome/common/render_messages.h" 21 #include "chrome/common/render_messages.h"
22 #include "chrome/renderer/prerender/prerender_helper.h" 22 #include "chrome/renderer/prerender/prerender_helper.h"
23 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" 23 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
24 #include "components/printing/common/print_messages.h"
25 #include "components/printing/renderer/print_web_view_helper.h"
26 #include "components/translate/content/renderer/translate_helper.h" 24 #include "components/translate/content/renderer/translate_helper.h"
27 #include "content/public/renderer/render_frame.h" 25 #include "content/public/renderer/render_frame.h"
28 #include "content/public/renderer/render_view.h" 26 #include "content/public/renderer/render_view.h"
29 #include "extensions/common/constants.h" 27 #include "extensions/common/constants.h"
30 #include "net/base/net_util.h" 28 #include "net/base/net_util.h"
31 #include "skia/ext/image_operations.h" 29 #include "skia/ext/image_operations.h"
32 #include "third_party/WebKit/public/platform/WebImage.h" 30 #include "third_party/WebKit/public/platform/WebImage.h"
33 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm ptReply.h" 31 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm ptReply.h"
34 #include "third_party/WebKit/public/web/WebDataSource.h" 32 #include "third_party/WebKit/public/web/WebDataSource.h"
35 #include "third_party/WebKit/public/web/WebDocument.h" 33 #include "third_party/WebKit/public/web/WebDocument.h"
36 #include "third_party/WebKit/public/web/WebElement.h" 34 #include "third_party/WebKit/public/web/WebElement.h"
37 #include "third_party/WebKit/public/web/WebLocalFrame.h" 35 #include "third_party/WebKit/public/web/WebLocalFrame.h"
38 #include "third_party/WebKit/public/web/WebNode.h" 36 #include "third_party/WebKit/public/web/WebNode.h"
39 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 37 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
40 #include "third_party/skia/include/core/SkBitmap.h" 38 #include "third_party/skia/include/core/SkBitmap.h"
41 #include "ui/gfx/codec/jpeg_codec.h" 39 #include "ui/gfx/codec/jpeg_codec.h"
42 #include "ui/gfx/geometry/size_f.h" 40 #include "ui/gfx/geometry/size_f.h"
43 #include "url/gurl.h" 41 #include "url/gurl.h"
44 42
43 #if defined(ENABLE_PRINTING)
44 #include "components/printing/common/print_messages.h"
45 #include "components/printing/renderer/print_web_view_helper.h"
46 #endif
47
45 using blink::WebDataSource; 48 using blink::WebDataSource;
46 using blink::WebElement; 49 using blink::WebElement;
47 using blink::WebLocalFrame; 50 using blink::WebLocalFrame;
48 using blink::WebNode; 51 using blink::WebNode;
49 using blink::WebString; 52 using blink::WebString;
50 using content::SSLStatus; 53 using content::SSLStatus;
51 using content::RenderFrame; 54 using content::RenderFrame;
52 55
53 // Delay in milliseconds that we'll wait before capturing the page contents. 56 // Delay in milliseconds that we'll wait before capturing the page contents.
54 static const int kDelayForCaptureMs = 500; 57 static const int kDelayForCaptureMs = 500;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 if (handled) 141 if (handled)
139 return false; 142 return false;
140 143
141 IPC_BEGIN_MESSAGE_MAP(ChromeRenderFrameObserver, message) 144 IPC_BEGIN_MESSAGE_MAP(ChromeRenderFrameObserver, message)
142 IPC_MESSAGE_HANDLER(ChromeViewMsg_RequestReloadImageForContextNode, 145 IPC_MESSAGE_HANDLER(ChromeViewMsg_RequestReloadImageForContextNode,
143 OnRequestReloadImageForContextNode) 146 OnRequestReloadImageForContextNode)
144 IPC_MESSAGE_HANDLER(ChromeViewMsg_RequestThumbnailForContextNode, 147 IPC_MESSAGE_HANDLER(ChromeViewMsg_RequestThumbnailForContextNode,
145 OnRequestThumbnailForContextNode) 148 OnRequestThumbnailForContextNode)
146 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetClientSidePhishingDetection, 149 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetClientSidePhishingDetection,
147 OnSetClientSidePhishingDetection) 150 OnSetClientSidePhishingDetection)
151 #if defined(ENABLE_PRINTING)
148 IPC_MESSAGE_HANDLER(PrintMsg_PrintNodeUnderContextMenu, 152 IPC_MESSAGE_HANDLER(PrintMsg_PrintNodeUnderContextMenu,
149 OnPrintNodeUnderContextMenu) 153 OnPrintNodeUnderContextMenu)
154 #endif
150 IPC_MESSAGE_HANDLER(ChromeViewMsg_AppBannerPromptRequest, 155 IPC_MESSAGE_HANDLER(ChromeViewMsg_AppBannerPromptRequest,
151 OnAppBannerPromptRequest) 156 OnAppBannerPromptRequest)
152 IPC_MESSAGE_UNHANDLED(handled = false) 157 IPC_MESSAGE_UNHANDLED(handled = false)
153 IPC_END_MESSAGE_MAP() 158 IPC_END_MESSAGE_MAP()
154 159
155 return handled; 160 return handled;
156 } 161 }
157 162
158 void ChromeRenderFrameObserver::OnSetIsPrerendering(bool is_prerendering) { 163 void ChromeRenderFrameObserver::OnSetIsPrerendering(bool is_prerendering) {
159 if (is_prerendering) { 164 if (is_prerendering) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 gfx::JPEGCodec::FORMAT_SkBitmap, bitmap.width(), bitmap.height(), 214 gfx::JPEGCodec::FORMAT_SkBitmap, bitmap.width(), bitmap.height(),
210 static_cast<int>(bitmap.rowBytes()), kDefaultQuality, &data)) 215 static_cast<int>(bitmap.rowBytes()), kDefaultQuality, &data))
211 thumbnail_data = std::string(data.begin(), data.end()); 216 thumbnail_data = std::string(data.begin(), data.end());
212 } 217 }
213 218
214 Send(new ChromeViewHostMsg_RequestThumbnailForContextNode_ACK( 219 Send(new ChromeViewHostMsg_RequestThumbnailForContextNode_ACK(
215 routing_id(), thumbnail_data, original_size, callback_id)); 220 routing_id(), thumbnail_data, original_size, callback_id));
216 } 221 }
217 222
218 void ChromeRenderFrameObserver::OnPrintNodeUnderContextMenu() { 223 void ChromeRenderFrameObserver::OnPrintNodeUnderContextMenu() {
224 #if defined(ENABLE_PRINTING)
219 printing::PrintWebViewHelper* helper = 225 printing::PrintWebViewHelper* helper =
220 printing::PrintWebViewHelper::Get(render_frame()->GetRenderView()); 226 printing::PrintWebViewHelper::Get(render_frame()->GetRenderView());
221 if (helper) 227 if (helper)
222 helper->PrintNode(render_frame()->GetContextMenuNode()); 228 helper->PrintNode(render_frame()->GetContextMenuNode());
229 #endif
223 } 230 }
224 231
225 void ChromeRenderFrameObserver::OnSetClientSidePhishingDetection( 232 void ChromeRenderFrameObserver::OnSetClientSidePhishingDetection(
226 bool enable_phishing_detection) { 233 bool enable_phishing_detection) {
227 #if defined(FULL_SAFE_BROWSING) && !defined(OS_CHROMEOS) 234 #if defined(FULL_SAFE_BROWSING) && !defined(OS_CHROMEOS)
228 phishing_classifier_ = 235 phishing_classifier_ =
229 enable_phishing_detection 236 enable_phishing_detection
230 ? safe_browsing::PhishingClassifierDelegate::Create(render_frame(), 237 ? safe_browsing::PhishingClassifierDelegate::Create(render_frame(),
231 nullptr) 238 nullptr)
232 : nullptr; 239 : nullptr;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 #endif 390 #endif
384 } 391 }
385 392
386 void ChromeRenderFrameObserver::CapturePageTextLater( 393 void ChromeRenderFrameObserver::CapturePageTextLater(
387 TextCaptureType capture_type, 394 TextCaptureType capture_type,
388 base::TimeDelta delay) { 395 base::TimeDelta delay) {
389 capture_timer_.Start(FROM_HERE, delay, 396 capture_timer_.Start(FROM_HERE, delay,
390 base::Bind(&ChromeRenderFrameObserver::CapturePageText, 397 base::Bind(&ChromeRenderFrameObserver::CapturePageText,
391 base::Unretained(this), capture_type)); 398 base::Unretained(this), capture_type));
392 } 399 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.cc ('k') | components/printing/common/print_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698