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

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

Issue 290573013: LanguageState should be owned by TranslateManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Inlining the DidNavigate function 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
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // context menu. 75 // context menu.
76 DCHECK(step == translate::TRANSLATE_STEP_TRANSLATING || 76 DCHECK(step == translate::TRANSLATE_STEP_TRANSLATING ||
77 step == translate::TRANSLATE_STEP_AFTER_TRANSLATE); 77 step == translate::TRANSLATE_STEP_AFTER_TRANSLATE);
78 DCHECK_EQ(translate::kUnknownLanguageCode, original_language); 78 DCHECK_EQ(translate::kUnknownLanguageCode, original_language);
79 } 79 }
80 } 80 }
81 81
82 // Do not create the after translate infobar if we are auto translating. 82 // Do not create the after translate infobar if we are auto translating.
83 if (((step == translate::TRANSLATE_STEP_AFTER_TRANSLATE) || 83 if (((step == translate::TRANSLATE_STEP_AFTER_TRANSLATE) ||
84 (step == translate::TRANSLATE_STEP_TRANSLATING)) && 84 (step == translate::TRANSLATE_STEP_TRANSLATING)) &&
85 translate_manager->translate_client()->GetTranslateDriver() 85 translate_manager->GetLanguageState().InTranslateNavigation()) {
86 ->GetLanguageState().InTranslateNavigation()) {
87 return; 86 return;
88 } 87 }
89 88
90 // Find any existing translate infobar delegate. 89 // Find any existing translate infobar delegate.
91 infobars::InfoBar* old_infobar = NULL; 90 infobars::InfoBar* old_infobar = NULL;
92 TranslateInfoBarDelegate* old_delegate = NULL; 91 TranslateInfoBarDelegate* old_delegate = NULL;
93 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { 92 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
94 old_infobar = infobar_service->infobar_at(i); 93 old_infobar = infobar_service->infobar_at(i);
95 old_delegate = old_infobar->delegate()->AsTranslateInfoBarDelegate(); 94 old_delegate = old_infobar->delegate()->AsTranslateInfoBarDelegate();
96 if (old_delegate) { 95 if (old_delegate) {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 if (!details.is_navigation_to_different_page && !details.is_main_frame) 375 if (!details.is_navigation_to_different_page && !details.is_main_frame)
377 return false; 376 return false;
378 377
379 return infobars::InfoBarDelegate::ShouldExpireInternal(details); 378 return infobars::InfoBarDelegate::ShouldExpireInternal(details);
380 } 379 }
381 380
382 TranslateInfoBarDelegate* 381 TranslateInfoBarDelegate*
383 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { 382 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() {
384 return this; 383 return this;
385 } 384 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/translate/translate_tab_helper.h » ('j') | chrome/browser/translate/translate_tab_helper.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698