OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/translate/translate_helper.h" | 5 #include "chrome/renderer/translate/translate_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 : content::RenderViewObserver(render_view), | 70 : content::RenderViewObserver(render_view), |
71 page_id_(-1), | 71 page_id_(-1), |
72 translation_pending_(false), | 72 translation_pending_(false), |
73 weak_method_factory_(this) { | 73 weak_method_factory_(this) { |
74 } | 74 } |
75 | 75 |
76 TranslateHelper::~TranslateHelper() { | 76 TranslateHelper::~TranslateHelper() { |
77 CancelPendingTranslation(); | 77 CancelPendingTranslation(); |
78 } | 78 } |
79 | 79 |
80 void TranslateHelper::PageCaptured(int page_id, const string16& contents) { | 80 void TranslateHelper::PageCaptured(int page_id, |
| 81 const base::string16& contents) { |
81 // Get the document language as set by WebKit from the http-equiv | 82 // Get the document language as set by WebKit from the http-equiv |
82 // meta tag for "content-language". This may or may not also | 83 // meta tag for "content-language". This may or may not also |
83 // have a value derived from the actual Content-Language HTTP | 84 // have a value derived from the actual Content-Language HTTP |
84 // header. The two actually have different meanings (despite the | 85 // header. The two actually have different meanings (despite the |
85 // original intent of http-equiv to be an equivalent) with the former | 86 // original intent of http-equiv to be an equivalent) with the former |
86 // being the language of the document and the latter being the | 87 // being the language of the document and the latter being the |
87 // language of the intended audience (a distinction really only | 88 // language of the intended audience (a distinction really only |
88 // relevant for things like langauge textbooks). This distinction | 89 // relevant for things like langauge textbooks). This distinction |
89 // shouldn't affect translation. | 90 // shouldn't affect translation. |
90 WebFrame* main_frame = GetMainFrame(); | 91 WebFrame* main_frame = GetMainFrame(); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 491 |
491 WebFrame* TranslateHelper::GetMainFrame() { | 492 WebFrame* TranslateHelper::GetMainFrame() { |
492 WebView* web_view = render_view()->GetWebView(); | 493 WebView* web_view = render_view()->GetWebView(); |
493 | 494 |
494 // When the tab is going to be closed, the web_view can be NULL. | 495 // When the tab is going to be closed, the web_view can be NULL. |
495 if (!web_view) | 496 if (!web_view) |
496 return NULL; | 497 return NULL; |
497 | 498 |
498 return web_view->mainFrame(); | 499 return web_view->mainFrame(); |
499 } | 500 } |
OLD | NEW |