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

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

Issue 1801002: AutoFill: Notify the renderer when the page has finished translating. Extract (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Update comment. Created 10 years, 7 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
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_helper.h" 5 #include "chrome/renderer/translate_helper.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "chrome/renderer/render_view.h" 8 #include "chrome/renderer/render_view.h"
9 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" 9 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
10 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" 10 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 actual_source_lang = source_lang_; 189 actual_source_lang = source_lang_;
190 } 190 }
191 191
192 if (!translation_pending_) { 192 if (!translation_pending_) {
193 NOTREACHED(); 193 NOTREACHED();
194 return; 194 return;
195 } 195 }
196 196
197 translation_pending_ = false; 197 translation_pending_ = false;
198 198
199 // Notify the renderer we are done.
200 render_view_->OnPageTranslated();
201
199 // Notify the browser we are done. 202 // Notify the browser we are done.
200 render_view_->Send(new ViewHostMsg_PageTranslated( 203 render_view_->Send(new ViewHostMsg_PageTranslated(
201 render_view_->routing_id(), render_view_->page_id(), 204 render_view_->routing_id(), render_view_->page_id(),
202 actual_source_lang, target_lang_, TranslateErrors::NONE)); 205 actual_source_lang, target_lang_, TranslateErrors::NONE));
203 return; 206 return;
204 } 207 }
205 208
206 // The translation is still pending, check again later. 209 // The translation is still pending, check again later.
207 MessageLoop::current()->PostDelayedTask(FROM_HERE, 210 MessageLoop::current()->PostDelayedTask(FROM_HERE,
208 method_factory_.NewRunnableMethod(&TranslateHelper::CheckTranslateStatus), 211 method_factory_.NewRunnableMethod(&TranslateHelper::CheckTranslateStatus),
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 DontDelayTasks() ? 0 : kTranslateStatusCheckDelayMs); 285 DontDelayTasks() ? 0 : kTranslateStatusCheckDelayMs);
283 } 286 }
284 287
285 void TranslateHelper::NotifyBrowserTranslationFailed( 288 void TranslateHelper::NotifyBrowserTranslationFailed(
286 TranslateErrors::Type error) { 289 TranslateErrors::Type error) {
287 translation_pending_ = false; 290 translation_pending_ = false;
288 // Notify the browser there was an error. 291 // Notify the browser there was an error.
289 render_view_->Send(new ViewHostMsg_PageTranslated( 292 render_view_->Send(new ViewHostMsg_PageTranslated(
290 render_view_->routing_id(), page_id_, source_lang_, target_lang_, error)); 293 render_view_->routing_id(), page_id_, source_lang_, target_lang_, error));
291 } 294 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698