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

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

Issue 133273029: Move LanguageState to the translate component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment + rebase Created 6 years, 11 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 (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_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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 DCHECK_EQ(translate::kUnknownLanguageCode, original_language); 52 DCHECK_EQ(translate::kUnknownLanguageCode, original_language);
53 } 53 }
54 } 54 }
55 55
56 // Do not create the after translate infobar if we are auto translating. 56 // Do not create the after translate infobar if we are auto translating.
57 if ((infobar_type == TranslateInfoBarDelegate::AFTER_TRANSLATE) || 57 if ((infobar_type == TranslateInfoBarDelegate::AFTER_TRANSLATE) ||
58 (infobar_type == TranslateInfoBarDelegate::TRANSLATING)) { 58 (infobar_type == TranslateInfoBarDelegate::TRANSLATING)) {
59 TranslateTabHelper* translate_tab_helper = 59 TranslateTabHelper* translate_tab_helper =
60 TranslateTabHelper::FromWebContents(web_contents); 60 TranslateTabHelper::FromWebContents(web_contents);
61 if (!translate_tab_helper || 61 if (!translate_tab_helper ||
62 translate_tab_helper->language_state().InTranslateNavigation()) 62 translate_tab_helper->GetLanguageState().InTranslateNavigation())
63 return; 63 return;
64 } 64 }
65 65
66 // Find any existing translate infobar delegate. 66 // Find any existing translate infobar delegate.
67 InfoBar* old_infobar = NULL; 67 InfoBar* old_infobar = NULL;
68 InfoBarService* infobar_service = 68 InfoBarService* infobar_service =
69 InfoBarService::FromWebContents(web_contents); 69 InfoBarService::FromWebContents(web_contents);
70 TranslateInfoBarDelegate* old_delegate = NULL; 70 TranslateInfoBarDelegate* old_delegate = NULL;
71 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { 71 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
72 old_infobar = infobar_service->infobar_at(i); 72 old_infobar = infobar_service->infobar_at(i);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 if (!details.is_navigation_to_different_page() && !details.is_main_frame) 339 if (!details.is_navigation_to_different_page() && !details.is_main_frame)
340 return false; 340 return false;
341 341
342 return InfoBarDelegate::ShouldExpireInternal(details); 342 return InfoBarDelegate::ShouldExpireInternal(details);
343 } 343 }
344 344
345 TranslateInfoBarDelegate* 345 TranslateInfoBarDelegate*
346 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { 346 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() {
347 return this; 347 return this;
348 } 348 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.cc ('k') | chrome/browser/translate/translate_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698