Chromium Code Reviews| Index: chrome/browser/translate/options_menu_model.cc |
| diff --git a/chrome/browser/translate/options_menu_model.cc b/chrome/browser/translate/options_menu_model.cc |
| index 6422f1673cbfc61612ed6b50c2839030c66a05f4..a0b81e9a7682ad02d0acd3de621814b610a01025 100644 |
| --- a/chrome/browser/translate/options_menu_model.cc |
| +++ b/chrome/browser/translate/options_menu_model.cc |
| @@ -7,24 +7,27 @@ |
| #include "base/metrics/histogram.h" |
| #include "chrome/app/chrome_command_ids.h" |
| #include "chrome/browser/translate/translate_infobar_delegate.h" |
| -#include "chrome/common/url_constants.h" |
| -#include "content/public/browser/web_contents.h" |
| +#include "components/translate/core/browser/translate_client.h" |
| +#include "components/translate/core/browser/translate_driver.h" |
| #include "grit/component_strings.h" |
| #include "grit/locale_settings.h" |
| #include "ui/base/l10n/l10n_util.h" |
| -using content::NavigationEntry; |
| -using content::OpenURLParams; |
| -using content::Referrer; |
| -using content::WebContents; |
| +namespace { |
| + |
| +const char kAboutGoogleTranslateURL[] = |
|
blundell
2014/05/19 12:38:42
Why did you move this here, out of curiosity?
|
| +#if defined(OS_CHROMEOS) |
| + "https://support.google.com/chromeos/?p=ib_translation_bar"; |
| +#else |
| + "https://support.google.com/chrome/?p=ib_translation_bar"; |
| +#endif |
| + |
| +} // namespace |
| OptionsMenuModel::OptionsMenuModel( |
| TranslateInfoBarDelegate* translate_delegate) |
| : ui::SimpleMenuModel(this), |
| translate_infobar_delegate_(translate_delegate) { |
| - // |translate_delegate| must already be owned. |
| - DCHECK(translate_infobar_delegate_->GetWebContents()); |
| - |
| base::string16 original_language = translate_delegate->language_name_at( |
| translate_delegate->original_language_index()); |
| base::string16 target_language = translate_delegate->language_name_at( |
| @@ -121,12 +124,11 @@ void OptionsMenuModel::ExecuteCommand(int command_id, int event_flags) { |
| break; |
| case IDC_TRANSLATE_OPTIONS_ABOUT: { |
| - WebContents* web_contents = translate_infobar_delegate_->GetWebContents(); |
|
blundell
2014/05/19 12:38:42
It seems like it would also be OK for this code to
|
| - if (web_contents) { |
| - OpenURLParams params( |
| - GURL(chrome::kAboutGoogleTranslateURL), Referrer(), |
| - NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false); |
| - web_contents->OpenURL(params); |
| + TranslateClient* translate_client = |
| + translate_infobar_delegate_->GetTranslateClient(); |
| + if (translate_client) { |
| + translate_client->GetTranslateDriver()->OpenUrlInNewTab( |
| + GURL(kAboutGoogleTranslateURL)); |
| } |
| break; |
| } |