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 #include "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 #include "chrome/common/extensions/extension.h" | 35 #include "chrome/common/extensions/extension.h" |
| 36 #include "chrome/common/file_system/file_system_dispatcher.h" | 36 #include "chrome/common/file_system/file_system_dispatcher.h" |
| 37 #include "chrome/common/file_system/webfilesystem_callback_dispatcher.h" | 37 #include "chrome/common/file_system/webfilesystem_callback_dispatcher.h" |
| 38 #include "chrome/common/json_value_serializer.h" | 38 #include "chrome/common/json_value_serializer.h" |
| 39 #include "chrome/common/jstemplate_builder.h" | 39 #include "chrome/common/jstemplate_builder.h" |
| 40 #include "chrome/common/notification_service.h" | 40 #include "chrome/common/notification_service.h" |
| 41 #include "chrome/common/page_zoom.h" | 41 #include "chrome/common/page_zoom.h" |
| 42 #include "chrome/common/pepper_plugin_registry.h" | 42 #include "chrome/common/pepper_plugin_registry.h" |
| 43 #include "chrome/common/render_messages.h" | 43 #include "chrome/common/render_messages.h" |
| 44 #include "chrome/common/renderer_preferences.h" | 44 #include "chrome/common/renderer_preferences.h" |
| 45 #include "chrome/common/thumbnail_score.h" | |
| 46 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
| 47 #include "chrome/common/web_apps.h" | 46 #include "chrome/common/web_apps.h" |
| 48 #include "chrome/common/window_container_type.h" | 47 #include "chrome/common/window_container_type.h" |
| 49 #include "chrome/renderer/about_handler.h" | 48 #include "chrome/renderer/about_handler.h" |
| 50 #include "chrome/renderer/audio_message_filter.h" | 49 #include "chrome/renderer/audio_message_filter.h" |
| 51 #include "chrome/renderer/autofill_helper.h" | 50 #include "chrome/renderer/autofill_helper.h" |
| 52 #include "chrome/renderer/automation/dom_automation_controller.h" | 51 #include "chrome/renderer/automation/dom_automation_controller.h" |
| 53 #include "chrome/renderer/blocked_plugin.h" | 52 #include "chrome/renderer/blocked_plugin.h" |
| 54 #include "chrome/renderer/device_orientation_dispatcher.h" | 53 #include "chrome/renderer/device_orientation_dispatcher.h" |
| 55 #include "chrome/renderer/devtools_agent.h" | 54 #include "chrome/renderer/devtools_agent.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 using webkit_glue::PasswordFormDomManager; | 275 using webkit_glue::PasswordFormDomManager; |
| 277 using webkit_glue::ResourceFetcher; | 276 using webkit_glue::ResourceFetcher; |
| 278 using webkit_glue::SiteIsolationMetrics; | 277 using webkit_glue::SiteIsolationMetrics; |
| 279 using webkit_glue::WebAccessibility; | 278 using webkit_glue::WebAccessibility; |
| 280 | 279 |
| 281 //----------------------------------------------------------------------------- | 280 //----------------------------------------------------------------------------- |
| 282 | 281 |
| 283 typedef std::map<WebKit::WebView*, RenderView*> ViewMap; | 282 typedef std::map<WebKit::WebView*, RenderView*> ViewMap; |
| 284 static base::LazyInstance<ViewMap> g_view_map(base::LINKER_INITIALIZED); | 283 static base::LazyInstance<ViewMap> g_view_map(base::LINKER_INITIALIZED); |
| 285 | 284 |
| 286 // define to write the time necessary for thumbnail/DOM text retrieval, | |
| 287 // respectively, into the system debug log | |
| 288 // #define TIME_TEXT_RETRIEVAL | |
| 289 | |
| 290 // maximum number of characters in the document to index, any text beyond this | 285 // maximum number of characters in the document to index, any text beyond this |
| 291 // point will be clipped | 286 // point will be clipped |
| 292 static const size_t kMaxIndexChars = 65535; | 287 static const size_t kMaxIndexChars = 65535; |
| 293 | 288 |
| 294 // Size of the thumbnails that we'll generate | 289 // Delay in milliseconds that we'll wait before capturing the page contents. |
| 295 static const int kThumbnailWidth = 212; | |
| 296 static const int kThumbnailHeight = 132; | |
| 297 | |
| 298 // Delay in milliseconds that we'll wait before capturing the page contents | |
| 299 // and thumbnail. | |
| 300 static const int kDelayForCaptureMs = 500; | 290 static const int kDelayForCaptureMs = 500; |
| 301 | 291 |
| 302 // Typically, we capture the page data once the page is loaded. | 292 // Typically, we capture the page data once the page is loaded. |
| 303 // Sometimes, the page never finishes to load, preventing the page capture | 293 // Sometimes, the page never finishes to load, preventing the page capture |
| 304 // To workaround this problem, we always perform a capture after the following | 294 // To workaround this problem, we always perform a capture after the following |
| 305 // delay. | 295 // delay. |
| 306 static const int kDelayForForcedCaptureMs = 6000; | 296 static const int kDelayForForcedCaptureMs = 6000; |
| 307 | 297 |
| 308 // Time, in seconds, we delay before sending content state changes (such as form | 298 // Time, in seconds, we delay before sending content state changes (such as form |
| 309 // state and scroll position) to the browser. We delay sending changes to avoid | 299 // state and scroll position) to the browser. We delay sending changes to avoid |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 338 return false; | 328 return false; |
| 339 | 329 |
| 340 view->paint(webkit_glue::ToWebCanvas(&canvas), | 330 view->paint(webkit_glue::ToWebCanvas(&canvas), |
| 341 WebRect(0, 0, size.width, size.height)); | 331 WebRect(0, 0, size.width, size.height)); |
| 342 // TODO: Add a way to snapshot the whole page, not just the currently | 332 // TODO: Add a way to snapshot the whole page, not just the currently |
| 343 // visible part. | 333 // visible part. |
| 344 | 334 |
| 345 return true; | 335 return true; |
| 346 } | 336 } |
| 347 | 337 |
| 348 // Calculates how "boring" a thumbnail is. The boring score is the | |
| 349 // 0,1 ranged percentage of pixels that are the most common | |
| 350 // luma. Higher boring scores indicate that a higher percentage of a | |
| 351 // bitmap are all the same brightness. | |
| 352 static double CalculateBoringScore(SkBitmap* bitmap) { | |
| 353 int histogram[256] = {0}; | |
| 354 color_utils::BuildLumaHistogram(bitmap, histogram); | |
| 355 | |
| 356 int color_count = *std::max_element(histogram, histogram + 256); | |
| 357 int pixel_count = bitmap->width() * bitmap->height(); | |
| 358 return static_cast<double>(color_count) / pixel_count; | |
| 359 } | |
| 360 | |
| 361 // True if |frame| contains content that is white-listed for content settings. | 338 // True if |frame| contains content that is white-listed for content settings. |
| 362 static bool IsWhitelistedForContentSettings(WebFrame* frame) { | 339 static bool IsWhitelistedForContentSettings(WebFrame* frame) { |
| 363 WebSecurityOrigin origin = frame->securityOrigin(); | 340 WebSecurityOrigin origin = frame->securityOrigin(); |
| 364 if (origin.isEmpty()) | 341 if (origin.isEmpty()) |
| 365 return false; // Uninitialized document? | 342 return false; // Uninitialized document? |
| 366 | 343 |
| 367 if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme)) | 344 if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme)) |
| 368 return true; // Browser UI elements should still work. | 345 return true; // Browser UI elements should still work. |
| 369 | 346 |
| 370 // If the scheme is ftp: or file:, an empty file name indicates a directory | 347 // If the scheme is ftp: or file:, an empty file name indicates a directory |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 956 child_process_logging::SetActiveURL(main_frame->url()); | 933 child_process_logging::SetActiveURL(main_frame->url()); |
| 957 | 934 |
| 958 ObserverListBase<RenderViewObserver>::Iterator it(observers_); | 935 ObserverListBase<RenderViewObserver>::Iterator it(observers_); |
| 959 RenderViewObserver* observer; | 936 RenderViewObserver* observer; |
| 960 while ((observer = it.GetNext()) != NULL) | 937 while ((observer = it.GetNext()) != NULL) |
| 961 if (observer->OnMessageReceived(message)) | 938 if (observer->OnMessageReceived(message)) |
| 962 return true; | 939 return true; |
| 963 | 940 |
| 964 bool handled = true; | 941 bool handled = true; |
| 965 IPC_BEGIN_MESSAGE_MAP(RenderView, message) | 942 IPC_BEGIN_MESSAGE_MAP(RenderView, message) |
| 966 IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, OnCaptureThumbnail) | |
| 967 IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, OnCaptureSnapshot) | 943 IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, OnCaptureSnapshot) |
| 968 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages) | 944 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages) |
| 969 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone) | 945 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone) |
| 970 IPC_MESSAGE_HANDLER(ViewMsg_PrintPreview, OnPrintPreview) | 946 IPC_MESSAGE_HANDLER(ViewMsg_PrintPreview, OnPrintPreview) |
| 971 IPC_MESSAGE_HANDLER(ViewMsg_PrintNodeUnderContextMenu, | 947 IPC_MESSAGE_HANDLER(ViewMsg_PrintNodeUnderContextMenu, |
| 972 OnPrintNodeUnderContextMenu) | 948 OnPrintNodeUnderContextMenu) |
| 973 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) | 949 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) |
| 974 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) | 950 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) |
| 975 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) | 951 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) |
| 976 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) | 952 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1095 IPC_MESSAGE_HANDLER(ViewMsg_JavaScriptStressTestControl, | 1071 IPC_MESSAGE_HANDLER(ViewMsg_JavaScriptStressTestControl, |
| 1096 OnJavaScriptStressTestControl) | 1072 OnJavaScriptStressTestControl) |
| 1097 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) | 1073 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) |
| 1098 | 1074 |
| 1099 // Have the super handle all other messages. | 1075 // Have the super handle all other messages. |
| 1100 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 1076 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
| 1101 IPC_END_MESSAGE_MAP() | 1077 IPC_END_MESSAGE_MAP() |
| 1102 return handled; | 1078 return handled; |
| 1103 } | 1079 } |
| 1104 | 1080 |
| 1105 void RenderView::OnCaptureThumbnail() { | |
| 1106 WebFrame* main_frame = webview()->mainFrame(); | |
| 1107 if (!main_frame) | |
| 1108 return; | |
| 1109 | |
| 1110 // get the URL for this page | |
| 1111 GURL url(main_frame->url()); | |
| 1112 if (url.is_empty()) | |
| 1113 return; | |
| 1114 | |
| 1115 if (size_.IsEmpty()) | |
| 1116 return; // Don't create an empty thumbnail! | |
| 1117 | |
| 1118 ThumbnailScore score; | |
| 1119 SkBitmap thumbnail; | |
| 1120 if (!CaptureThumbnail(webview(), kThumbnailWidth, kThumbnailHeight, | |
| 1121 &thumbnail, &score)) | |
| 1122 return; | |
| 1123 | |
| 1124 // send the thumbnail message to the browser process | |
| 1125 Send(new ViewHostMsg_Thumbnail(routing_id_, url, score, thumbnail)); | |
| 1126 } | |
| 1127 | |
| 1128 void RenderView::OnCaptureSnapshot() { | 1081 void RenderView::OnCaptureSnapshot() { |
| 1129 SkBitmap snapshot; | 1082 SkBitmap snapshot; |
| 1130 bool error = false; | 1083 bool error = false; |
| 1131 | 1084 |
| 1132 WebFrame* main_frame = webview()->mainFrame(); | 1085 WebFrame* main_frame = webview()->mainFrame(); |
| 1133 if (!main_frame) | 1086 if (!main_frame) |
| 1134 error = true; | 1087 error = true; |
| 1135 | 1088 |
| 1136 if (!error && !CaptureSnapshot(webview(), &snapshot)) | 1089 if (!error && !CaptureSnapshot(webview(), &snapshot)) |
| 1137 error = true; | 1090 error = true; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1199 | 1152 |
| 1200 WebFrame* main_frame = webview()->mainFrame(); | 1153 WebFrame* main_frame = webview()->mainFrame(); |
| 1201 if (!main_frame) | 1154 if (!main_frame) |
| 1202 return; | 1155 return; |
| 1203 | 1156 |
| 1204 // Don't index/capture pages that are in view source mode. | 1157 // Don't index/capture pages that are in view source mode. |
| 1205 if (main_frame->isViewSourceModeEnabled()) | 1158 if (main_frame->isViewSourceModeEnabled()) |
| 1206 return; | 1159 return; |
| 1207 | 1160 |
| 1208 // Don't index/capture pages that failed to load. This only checks the top | 1161 // Don't index/capture pages that failed to load. This only checks the top |
| 1209 // level frame so the thumbnail may contain a frame that failed to load. | 1162 // level frame. |
| 1210 WebDataSource* ds = main_frame->dataSource(); | 1163 WebDataSource* ds = main_frame->dataSource(); |
| 1211 if (ds && ds->hasUnreachableURL()) | 1164 if (ds && ds->hasUnreachableURL()) |
| 1212 return; | 1165 return; |
| 1213 | 1166 |
| 1214 if (!preliminary_capture) | 1167 if (!preliminary_capture) |
| 1215 last_indexed_page_id_ = load_id; | 1168 last_indexed_page_id_ = load_id; |
| 1216 | 1169 |
| 1217 // Get the URL for this page. | 1170 // Get the URL for this page. |
| 1218 GURL url(main_frame->url()); | 1171 GURL url(main_frame->url()); |
| 1219 if (url.is_empty()) | 1172 if (url.is_empty()) |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1234 UMA_HISTOGRAM_MEDIUM_TIMES("Renderer4.LanguageDetection", | 1187 UMA_HISTOGRAM_MEDIUM_TIMES("Renderer4.LanguageDetection", |
| 1235 base::TimeTicks::Now() - begin_time); | 1188 base::TimeTicks::Now() - begin_time); |
| 1236 } | 1189 } |
| 1237 // Send the text to the browser for indexing (the browser might decide not | 1190 // Send the text to the browser for indexing (the browser might decide not |
| 1238 // to index, if the URL is HTTPS for instance) and language discovery. | 1191 // to index, if the URL is HTTPS for instance) and language discovery. |
| 1239 Send(new ViewHostMsg_PageContents( | 1192 Send(new ViewHostMsg_PageContents( |
| 1240 routing_id_, url, load_id, contents, language, | 1193 routing_id_, url, load_id, contents, language, |
| 1241 TranslateHelper::IsPageTranslatable(&document))); | 1194 TranslateHelper::IsPageTranslatable(&document))); |
| 1242 } | 1195 } |
| 1243 | 1196 |
| 1244 OnCaptureThumbnail(); | |
| 1245 | |
| 1246 if (phishing_delegate_.get()) | 1197 if (phishing_delegate_.get()) |
| 1247 phishing_delegate_->FinishedLoad(&contents); | 1198 phishing_delegate_->FinishedLoad(&contents); |
| 1248 } | 1199 } |
| 1249 | 1200 |
| 1250 void RenderView::CaptureText(WebFrame* frame, string16* contents) { | 1201 void RenderView::CaptureText(WebFrame* frame, string16* contents) { |
| 1251 contents->clear(); | 1202 contents->clear(); |
| 1252 if (!frame) | 1203 if (!frame) |
| 1253 return; | 1204 return; |
| 1254 | 1205 |
| 1255 #ifdef TIME_TEXT_RETRIEVAL | 1206 #ifdef TIME_TEXT_RETRIEVAL |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1271 // partial word indexed at the end that might have been clipped. Therefore, | 1222 // partial word indexed at the end that might have been clipped. Therefore, |
| 1272 // terminate the string at the last space to ensure no words are clipped. | 1223 // terminate the string at the last space to ensure no words are clipped. |
| 1273 if (contents->size() == kMaxIndexChars) { | 1224 if (contents->size() == kMaxIndexChars) { |
| 1274 size_t last_space_index = contents->find_last_of(kWhitespaceUTF16); | 1225 size_t last_space_index = contents->find_last_of(kWhitespaceUTF16); |
| 1275 if (last_space_index == std::wstring::npos) | 1226 if (last_space_index == std::wstring::npos) |
| 1276 return; // don't index if we got a huge block of text with no spaces | 1227 return; // don't index if we got a huge block of text with no spaces |
| 1277 contents->resize(last_space_index); | 1228 contents->resize(last_space_index); |
| 1278 } | 1229 } |
| 1279 } | 1230 } |
| 1280 | 1231 |
| 1281 bool RenderView::CaptureThumbnail(WebView* view, | |
|
brettw
2011/01/18 18:25:42
I think we probably want to keep the old code and
satorux1
2011/01/19 01:36:36
That's a great idea. I'll change it accordingly.
| |
| 1282 int w, | |
| 1283 int h, | |
| 1284 SkBitmap* thumbnail, | |
| 1285 ThumbnailScore* score) { | |
| 1286 base::TimeTicks beginning_time = base::TimeTicks::Now(); | |
| 1287 | |
| 1288 skia::PlatformCanvas canvas; | |
| 1289 | |
| 1290 // Paint |view| into |canvas|. | |
| 1291 if (!PaintViewIntoCanvas(view, canvas)) | |
| 1292 return false; | |
| 1293 | |
| 1294 skia::BitmapPlatformDevice& device = | |
| 1295 static_cast<skia::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); | |
| 1296 | |
| 1297 const SkBitmap& src_bmp = device.accessBitmap(false); | |
| 1298 | |
| 1299 SkRect dest_rect = { 0, 0, SkIntToScalar(w), SkIntToScalar(h) }; | |
| 1300 float dest_aspect = dest_rect.width() / dest_rect.height(); | |
| 1301 | |
| 1302 // Get the src rect so that we can preserve the aspect ratio while filling | |
| 1303 // the destination. | |
| 1304 SkIRect src_rect; | |
| 1305 if (src_bmp.width() < dest_rect.width() || | |
| 1306 src_bmp.height() < dest_rect.height()) { | |
| 1307 // Source image is smaller: we clip the part of source image within the | |
| 1308 // dest rect, and then stretch it to fill the dest rect. We don't respect | |
| 1309 // the aspect ratio in this case. | |
| 1310 src_rect.set(0, 0, static_cast<S16CPU>(dest_rect.width()), | |
| 1311 static_cast<S16CPU>(dest_rect.height())); | |
| 1312 score->good_clipping = false; | |
| 1313 } else { | |
| 1314 float src_aspect = static_cast<float>(src_bmp.width()) / src_bmp.height(); | |
| 1315 if (src_aspect > dest_aspect) { | |
| 1316 // Wider than tall, clip horizontally: we center the smaller thumbnail in | |
| 1317 // the wider screen. | |
| 1318 S16CPU new_width = static_cast<S16CPU>(src_bmp.height() * dest_aspect); | |
| 1319 S16CPU x_offset = (src_bmp.width() - new_width) / 2; | |
| 1320 src_rect.set(x_offset, 0, new_width + x_offset, src_bmp.height()); | |
| 1321 score->good_clipping = false; | |
| 1322 } else { | |
| 1323 src_rect.set(0, 0, src_bmp.width(), | |
| 1324 static_cast<S16CPU>(src_bmp.width() / dest_aspect)); | |
| 1325 score->good_clipping = true; | |
| 1326 } | |
| 1327 } | |
| 1328 | |
| 1329 score->at_top = (view->mainFrame()->scrollOffset().height == 0); | |
| 1330 | |
| 1331 SkBitmap subset; | |
| 1332 device.accessBitmap(false).extractSubset(&subset, src_rect); | |
| 1333 | |
| 1334 // First do a fast downsample by powers of two to get close to the final size. | |
| 1335 SkBitmap downsampled_subset = | |
| 1336 SkBitmapOperations::DownsampleByTwoUntilSize(subset, w, h); | |
| 1337 | |
| 1338 // Do a high-quality resize from the downscaled size to the final size. | |
| 1339 *thumbnail = skia::ImageOperations::Resize( | |
| 1340 downsampled_subset, skia::ImageOperations::RESIZE_LANCZOS3, w, h); | |
| 1341 | |
| 1342 score->boring_score = CalculateBoringScore(thumbnail); | |
| 1343 | |
| 1344 HISTOGRAM_TIMES("Renderer4.Thumbnail", | |
| 1345 base::TimeTicks::Now() - beginning_time); | |
| 1346 | |
| 1347 return true; | |
| 1348 } | |
| 1349 | |
| 1350 bool RenderView::CaptureSnapshot(WebView* view, SkBitmap* snapshot) { | 1232 bool RenderView::CaptureSnapshot(WebView* view, SkBitmap* snapshot) { |
| 1351 base::TimeTicks beginning_time = base::TimeTicks::Now(); | 1233 base::TimeTicks beginning_time = base::TimeTicks::Now(); |
| 1352 | 1234 |
| 1353 skia::PlatformCanvas canvas; | 1235 skia::PlatformCanvas canvas; |
| 1354 if (!PaintViewIntoCanvas(view, canvas)) | 1236 if (!PaintViewIntoCanvas(view, canvas)) |
| 1355 return false; | 1237 return false; |
| 1356 | 1238 |
| 1357 skia::BitmapPlatformDevice& device = | 1239 skia::BitmapPlatformDevice& device = |
| 1358 static_cast<skia::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); | 1240 static_cast<skia::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); |
| 1359 | 1241 |
| (...skipping 3724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5084 // Notify the pepper plugins that we started painting. | 4966 // Notify the pepper plugins that we started painting. |
| 5085 pepper_delegate_.ViewInitiatedPaint(); | 4967 pepper_delegate_.ViewInitiatedPaint(); |
| 5086 | 4968 |
| 5087 // Notify any "old-style" pepper plugins that we started painting. This is | 4969 // Notify any "old-style" pepper plugins that we started painting. This is |
| 5088 // used for internal bookkeeping only, so we know that the set can not change | 4970 // used for internal bookkeeping only, so we know that the set can not change |
| 5089 // under us. | 4971 // under us. |
| 5090 for (std::set<WebPluginDelegatePepper*>::iterator i = | 4972 for (std::set<WebPluginDelegatePepper*>::iterator i = |
| 5091 current_oldstyle_pepper_plugins_.begin(); | 4973 current_oldstyle_pepper_plugins_.begin(); |
| 5092 i != current_oldstyle_pepper_plugins_.end(); ++i) | 4974 i != current_oldstyle_pepper_plugins_.end(); ++i) |
| 5093 (*i)->RenderViewInitiatedPaint(); | 4975 (*i)->RenderViewInitiatedPaint(); |
| 4976 | |
| 4977 WebKit::WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); | |
| 4978 gfx::Size gfx_scroll_offset(scroll_offset.width, scroll_offset.height); | |
| 4979 Send(new ViewHostMsg_UpdateScrollOffset(routing_id_, gfx_scroll_offset)); | |
|
brettw
2011/01/18 18:25:42
If you need something in RenderWidget, you can jus
satorux1
2011/01/19 01:36:36
Sounds like a good idea. I'll give it a try.
| |
| 5094 } | 4980 } |
| 5095 | 4981 |
| 5096 void RenderView::DidFlushPaint() { | 4982 void RenderView::DidFlushPaint() { |
| 5097 // Notify any pepper plugins that we painted. This will call into the plugin, | 4983 // Notify any pepper plugins that we painted. This will call into the plugin, |
| 5098 // and we it may ask to close itself as a result. This will, in turn, modify | 4984 // and we it may ask to close itself as a result. This will, in turn, modify |
| 5099 // our set, possibly invalidating the iterator. So we iterate on a copy that | 4985 // our set, possibly invalidating the iterator. So we iterate on a copy that |
| 5100 // won't change out from under us. | 4986 // won't change out from under us. |
| 5101 pepper_delegate_.ViewFlushedPaint(); | 4987 pepper_delegate_.ViewFlushedPaint(); |
| 5102 | 4988 |
| 5103 // Notify any old-style pepper plugins that we painted. This will call into | 4989 // Notify any old-style pepper plugins that we painted. This will call into |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5686 if (cmd == kJavaScriptStressTestSetStressRunType) { | 5572 if (cmd == kJavaScriptStressTestSetStressRunType) { |
| 5687 v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param)); | 5573 v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param)); |
| 5688 } else if (cmd == kJavaScriptStressTestPrepareStressRun) { | 5574 } else if (cmd == kJavaScriptStressTestPrepareStressRun) { |
| 5689 v8::Testing::PrepareStressRun(param); | 5575 v8::Testing::PrepareStressRun(param); |
| 5690 } | 5576 } |
| 5691 } | 5577 } |
| 5692 | 5578 |
| 5693 void RenderView::OnContextMenuClosed() { | 5579 void RenderView::OnContextMenuClosed() { |
| 5694 context_menu_node_.reset(); | 5580 context_menu_node_.reset(); |
| 5695 } | 5581 } |
| OLD | NEW |