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

Side by Side Diff: chrome/browser/translate/translate_manager.cc

Issue 10105030: TabContents -> WebContentsImpl, part 21. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
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/browser/translate/translate_manager.h" 5 #include "chrome/browser/translate/translate_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 // infobar if the user already dismissed one in that case. 331 // infobar if the user already dismissed one in that case.
332 return; 332 return;
333 } 333 }
334 if (entry->GetTransitionType() != content::PAGE_TRANSITION_RELOAD && 334 if (entry->GetTransitionType() != content::PAGE_TRANSITION_RELOAD &&
335 load_details->type != content::NAVIGATION_TYPE_SAME_PAGE) { 335 load_details->type != content::NAVIGATION_TYPE_SAME_PAGE) {
336 return; 336 return;
337 } 337 }
338 // When doing a page reload, we don't get a TAB_LANGUAGE_DETERMINED 338 // When doing a page reload, we don't get a TAB_LANGUAGE_DETERMINED
339 // notification. So we need to explictly initiate the translation. 339 // notification. So we need to explictly initiate the translation.
340 // Note that we delay it as the TranslateManager gets this notification 340 // Note that we delay it as the TranslateManager gets this notification
341 // before the TabContents and the TabContents processing might remove the 341 // before the WebContents and the WebContents processing might remove the
342 // current infobars. Since InitTranslation might add an infobar, it must 342 // current infobars. Since InitTranslation might add an infobar, it must
343 // be done after that. 343 // be done after that.
344 MessageLoop::current()->PostTask(FROM_HERE, 344 MessageLoop::current()->PostTask(FROM_HERE,
345 base::Bind( 345 base::Bind(
346 &TranslateManager::InitiateTranslationPosted, 346 &TranslateManager::InitiateTranslationPosted,
347 weak_method_factory_.GetWeakPtr(), 347 weak_method_factory_.GetWeakPtr(),
348 controller->GetWebContents()->GetRenderProcessHost()->GetID(), 348 controller->GetWebContents()->GetRenderProcessHost()->GetID(),
349 controller->GetWebContents()-> 349 controller->GetWebContents()->
350 GetRenderViewHost()->GetRoutingID(), 350 GetRenderViewHost()->GetRoutingID(),
351 helper->language_state().original_language())); 351 helper->language_state().original_language()));
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); 899 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper();
900 900
901 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { 901 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) {
902 TranslateInfoBarDelegate* delegate = 902 TranslateInfoBarDelegate* delegate =
903 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); 903 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate();
904 if (delegate) 904 if (delegate)
905 return delegate; 905 return delegate;
906 } 906 }
907 return NULL; 907 return NULL;
908 } 908 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698