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

Side by Side Diff: trunk/src/chrome/browser/translate/translate_infobar_delegate.cc

Issue 296003014: Revert 272217 "LanguageState should be owned by TranslateManager" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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_infobar_delegate.h" 5 #include "chrome/browser/translate/translate_infobar_delegate.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/string_compare.h" 9 #include "base/i18n/string_compare.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // context menu. 72 // context menu.
73 DCHECK(step == translate::TRANSLATE_STEP_TRANSLATING || 73 DCHECK(step == translate::TRANSLATE_STEP_TRANSLATING ||
74 step == translate::TRANSLATE_STEP_AFTER_TRANSLATE); 74 step == translate::TRANSLATE_STEP_AFTER_TRANSLATE);
75 DCHECK_EQ(translate::kUnknownLanguageCode, original_language); 75 DCHECK_EQ(translate::kUnknownLanguageCode, original_language);
76 } 76 }
77 } 77 }
78 78
79 // Do not create the after translate infobar if we are auto translating. 79 // Do not create the after translate infobar if we are auto translating.
80 if (((step == translate::TRANSLATE_STEP_AFTER_TRANSLATE) || 80 if (((step == translate::TRANSLATE_STEP_AFTER_TRANSLATE) ||
81 (step == translate::TRANSLATE_STEP_TRANSLATING)) && 81 (step == translate::TRANSLATE_STEP_TRANSLATING)) &&
82 translate_manager->GetLanguageState().InTranslateNavigation()) { 82 translate_manager->translate_client()->GetTranslateDriver()
83 ->GetLanguageState().InTranslateNavigation()) {
83 return; 84 return;
84 } 85 }
85 86
86 // Find any existing translate infobar delegate. 87 // Find any existing translate infobar delegate.
87 infobars::InfoBar* old_infobar = NULL; 88 infobars::InfoBar* old_infobar = NULL;
88 TranslateInfoBarDelegate* old_delegate = NULL; 89 TranslateInfoBarDelegate* old_delegate = NULL;
89 for (size_t i = 0; i < infobar_manager->infobar_count(); ++i) { 90 for (size_t i = 0; i < infobar_manager->infobar_count(); ++i) {
90 old_infobar = infobar_manager->infobar_at(i); 91 old_infobar = infobar_manager->infobar_at(i);
91 old_delegate = old_infobar->delegate()->AsTranslateInfoBarDelegate(); 92 old_delegate = old_infobar->delegate()->AsTranslateInfoBarDelegate();
92 if (old_delegate) { 93 if (old_delegate) {
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 if (!details.is_navigation_to_different_page && !details.is_main_frame) 375 if (!details.is_navigation_to_different_page && !details.is_main_frame)
375 return false; 376 return false;
376 377
377 return infobars::InfoBarDelegate::ShouldExpireInternal(details); 378 return infobars::InfoBarDelegate::ShouldExpireInternal(details);
378 } 379 }
379 380
380 TranslateInfoBarDelegate* 381 TranslateInfoBarDelegate*
381 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { 382 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() {
382 return this; 383 return this;
383 } 384 }
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/policy/policy_browsertest.cc ('k') | trunk/src/chrome/browser/translate/translate_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698