| OLD | NEW |
| 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> |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 if (prerender::PrerenderHelper::IsPrerendering(render_frame())) | 351 if (prerender::PrerenderHelper::IsPrerendering(render_frame())) |
| 352 return; | 352 return; |
| 353 | 353 |
| 354 base::TimeTicks capture_begin_time = base::TimeTicks::Now(); | 354 base::TimeTicks capture_begin_time = base::TimeTicks::Now(); |
| 355 | 355 |
| 356 // Retrieve the frame's full text (up to kMaxIndexChars), and pass it to the | 356 // Retrieve the frame's full text (up to kMaxIndexChars), and pass it to the |
| 357 // translate helper for language detection and possible translation. | 357 // translate helper for language detection and possible translation. |
| 358 // TODO(dglazkov): WebFrameContentDumper should only be used for | 358 // TODO(dglazkov): WebFrameContentDumper should only be used for |
| 359 // testing purposes. See http://crbug.com/585164. | 359 // testing purposes. See http://crbug.com/585164. |
| 360 base::string16 contents = | 360 base::string16 contents = |
| 361 WebFrameContentDumper::dumpFrameTreeAsText(frame, kMaxIndexChars); | 361 WebFrameContentDumper::deprecatedDumpFrameTreeAsText(frame, |
| 362 kMaxIndexChars); |
| 362 | 363 |
| 363 UMA_HISTOGRAM_TIMES(kTranslateCaptureText, | 364 UMA_HISTOGRAM_TIMES(kTranslateCaptureText, |
| 364 base::TimeTicks::Now() - capture_begin_time); | 365 base::TimeTicks::Now() - capture_begin_time); |
| 365 | 366 |
| 366 // We should run language detection only once. Parsing finishes before | 367 // We should run language detection only once. Parsing finishes before |
| 367 // the page loads, so let's pick that timing. | 368 // the page loads, so let's pick that timing. |
| 368 if (translate_helper_ && capture_type == PRELIMINARY_CAPTURE) | 369 if (translate_helper_ && capture_type == PRELIMINARY_CAPTURE) |
| 369 translate_helper_->PageCaptured(contents); | 370 translate_helper_->PageCaptured(contents); |
| 370 | 371 |
| 371 TRACE_EVENT0("renderer", "ChromeRenderFrameObserver::CapturePageText"); | 372 TRACE_EVENT0("renderer", "ChromeRenderFrameObserver::CapturePageText"); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 388 case blink::WebMeaningfulLayout::FinishedParsing: | 389 case blink::WebMeaningfulLayout::FinishedParsing: |
| 389 CapturePageText(PRELIMINARY_CAPTURE); | 390 CapturePageText(PRELIMINARY_CAPTURE); |
| 390 break; | 391 break; |
| 391 case blink::WebMeaningfulLayout::FinishedLoading: | 392 case blink::WebMeaningfulLayout::FinishedLoading: |
| 392 CapturePageText(FINAL_CAPTURE); | 393 CapturePageText(FINAL_CAPTURE); |
| 393 break; | 394 break; |
| 394 default: | 395 default: |
| 395 break; | 396 break; |
| 396 } | 397 } |
| 397 } | 398 } |
| OLD | NEW |