| 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/chrome_render_view_observer.h" | 5 #include "chrome/renderer/chrome_render_view_observer.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 last_indexed_page_id_ = load_id; | 498 last_indexed_page_id_ = load_id; |
| 499 | 499 |
| 500 // Get the URL for this page. | 500 // Get the URL for this page. |
| 501 GURL url(main_frame->url()); | 501 GURL url(main_frame->url()); |
| 502 if (url.is_empty()) | 502 if (url.is_empty()) |
| 503 return; | 503 return; |
| 504 | 504 |
| 505 // Retrieve the frame's full text. | 505 // Retrieve the frame's full text. |
| 506 string16 contents; | 506 string16 contents; |
| 507 CaptureText(main_frame, &contents); | 507 CaptureText(main_frame, &contents); |
| 508 if (translate_helper_) |
| 509 translate_helper_->PageCaptured(contents); |
| 508 if (contents.size()) { | 510 if (contents.size()) { |
| 509 if (translate_helper_) | |
| 510 translate_helper_->PageCaptured(contents); | |
| 511 // Send the text to the browser for indexing (the browser might decide not | 511 // Send the text to the browser for indexing (the browser might decide not |
| 512 // to index, if the URL is HTTPS for instance) and language discovery. | 512 // to index, if the URL is HTTPS for instance) and language discovery. |
| 513 Send(new ViewHostMsg_PageContents(routing_id(), url, load_id, contents)); | 513 Send(new ViewHostMsg_PageContents(routing_id(), url, load_id, contents)); |
| 514 } | 514 } |
| 515 | 515 |
| 516 // Generate the thumbnail here if the in-browser thumbnailing isn't | 516 // Generate the thumbnail here if the in-browser thumbnailing isn't |
| 517 // enabled. TODO(satorux): Remove this and related code once | 517 // enabled. TODO(satorux): Remove this and related code once |
| 518 // crbug.com/65936 is complete. | 518 // crbug.com/65936 is complete. |
| 519 if (!switches::IsInBrowserThumbnailingEnabled()) { | 519 if (!switches::IsInBrowserThumbnailingEnabled()) { |
| 520 CaptureThumbnail(); | 520 CaptureThumbnail(); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && !data.empty()) { | 725 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && !data.empty()) { |
| 726 // Decode the favicon using WebKit's image decoder. | 726 // Decode the favicon using WebKit's image decoder. |
| 727 webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize)); | 727 webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize)); |
| 728 const unsigned char* src_data = | 728 const unsigned char* src_data = |
| 729 reinterpret_cast<const unsigned char*>(&data[0]); | 729 reinterpret_cast<const unsigned char*>(&data[0]); |
| 730 | 730 |
| 731 return decoder.Decode(src_data, data.size()); | 731 return decoder.Decode(src_data, data.size()); |
| 732 } | 732 } |
| 733 return SkBitmap(); | 733 return SkBitmap(); |
| 734 } | 734 } |
| OLD | NEW |