OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } | 351 } |
352 if (language_code == target_language) | 352 if (language_code == target_language) |
353 target_language_index_ = iter - languages_.begin(); | 353 target_language_index_ = iter - languages_.begin(); |
354 } | 354 } |
355 } | 355 } |
356 | 356 |
357 bool TranslateInfoBarDelegate::ShouldExpire( | 357 bool TranslateInfoBarDelegate::ShouldExpire( |
358 const content::LoadCommittedDetails& details) const { | 358 const content::LoadCommittedDetails& details) const { |
359 // Note: we allow closing this infobar even if the main frame navigation | 359 // Note: we allow closing this infobar even if the main frame navigation |
360 // was programmatic and not initiated by the user - crbug.com/70261 . | 360 // was programmatic and not initiated by the user - crbug.com/70261 . |
361 if (!details.is_navigation_to_different_page() && !details.is_main_frame) | 361 if (!details.is_user_initiated_main_frame_load() && !details.is_main_frame) |
362 return false; | 362 return false; |
363 | 363 |
364 return InfoBarDelegate::ShouldExpireInternal(details); | 364 return InfoBarDelegate::ShouldExpireInternal(details); |
365 } | 365 } |
366 | 366 |
367 void TranslateInfoBarDelegate::InfoBarDismissed() { | 367 void TranslateInfoBarDelegate::InfoBarDismissed() { |
368 if (type_ != BEFORE_TRANSLATE) | 368 if (type_ != BEFORE_TRANSLATE) |
369 return; | 369 return; |
370 | 370 |
371 // The user closed the infobar without clicking the translate button. | 371 // The user closed the infobar without clicking the translate button. |
(...skipping 12 matching lines...) Expand all Loading... |
384 | 384 |
385 TranslateInfoBarDelegate* | 385 TranslateInfoBarDelegate* |
386 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { | 386 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { |
387 return this; | 387 return this; |
388 } | 388 } |
389 | 389 |
390 std::string TranslateInfoBarDelegate::GetPageHost() { | 390 std::string TranslateInfoBarDelegate::GetPageHost() { |
391 NavigationEntry* entry = tab_contents_->controller().GetActiveEntry(); | 391 NavigationEntry* entry = tab_contents_->controller().GetActiveEntry(); |
392 return entry ? entry->url().HostNoBrackets() : std::string(); | 392 return entry ? entry->url().HostNoBrackets() : std::string(); |
393 } | 393 } |
OLD | NEW |