Index: components/translate/core/browser/options_menu_model.cc |
diff --git a/chrome/browser/translate/options_menu_model.cc b/components/translate/core/browser/options_menu_model.cc |
similarity index 69% |
rename from chrome/browser/translate/options_menu_model.cc |
rename to components/translate/core/browser/options_menu_model.cc |
index 19fc5c298f045e2a68fc30196abb0f722f96f337..42a3bda9ff1c29c840b39d7661b47264d2eb7146 100644 |
--- a/chrome/browser/translate/options_menu_model.cc |
+++ b/components/translate/core/browser/options_menu_model.cc |
@@ -2,14 +2,12 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/browser/translate/options_menu_model.h" |
+#include "components/translate/core/browser/options_menu_model.h" |
#include "base/metrics/histogram.h" |
-#include "chrome/app/chrome_command_ids.h" |
-#include "chrome/browser/translate/translate_infobar_delegate.h" |
#include "components/translate/core/browser/translate_driver.h" |
+#include "components/translate/core/browser/translate_infobar_delegate.h" |
#include "grit/components_strings.h" |
-#include "grit/locale_settings.h" |
#include "ui/base/l10n/l10n_util.h" |
namespace { |
@@ -23,8 +21,7 @@ const char kAboutGoogleTranslateURL[] = |
} // namespace |
-OptionsMenuModel::OptionsMenuModel( |
- TranslateInfoBarDelegate* translate_delegate) |
+OptionsMenuModel::OptionsMenuModel(TranslateInfoBarDelegate* translate_delegate) |
: ui::SimpleMenuModel(this), |
translate_infobar_delegate_(translate_delegate) { |
// |translate_delegate| must already be owned. |
@@ -43,26 +40,25 @@ OptionsMenuModel::OptionsMenuModel( |
// Incognito mode does not get any preferences related items. |
if (!translate_delegate->is_off_the_record()) { |
if (!autodetermined_source_language) { |
- AddCheckItem(IDC_TRANSLATE_OPTIONS_ALWAYS, |
+ AddCheckItem(ALWAYS_TRANSLATE, |
l10n_util::GetStringFUTF16(IDS_TRANSLATE_INFOBAR_OPTIONS_ALWAYS, |
original_language, target_language)); |
- AddCheckItem(IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_LANG, |
- l10n_util::GetStringFUTF16( |
- IDS_TRANSLATE_INFOBAR_OPTIONS_NEVER_TRANSLATE_LANG, |
- original_language)); |
+ AddCheckItem(NEVER_TRANSLATE_LANGUAGE, |
+ l10n_util::GetStringFUTF16( |
+ IDS_TRANSLATE_INFOBAR_OPTIONS_NEVER_TRANSLATE_LANG, |
+ original_language)); |
} |
- AddCheckItem(IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_SITE, |
- l10n_util::GetStringUTF16( |
- IDS_TRANSLATE_INFOBAR_OPTIONS_NEVER_TRANSLATE_SITE)); |
+ AddCheckItem(NEVER_TRANSLATE_SITE, |
+ l10n_util::GetStringUTF16( |
+ IDS_TRANSLATE_INFOBAR_OPTIONS_NEVER_TRANSLATE_SITE)); |
AddSeparator(ui::NORMAL_SEPARATOR); |
} |
if (!autodetermined_source_language) { |
- AddItem(IDC_TRANSLATE_REPORT_BAD_LANGUAGE_DETECTION, |
+ AddItem(REPORT_BAD_DETECTION, |
l10n_util::GetStringFUTF16(IDS_TRANSLATE_INFOBAR_OPTIONS_REPORT_ERROR, |
original_language)); |
} |
- AddItemWithStringId(IDC_TRANSLATE_OPTIONS_ABOUT, |
- IDS_TRANSLATE_INFOBAR_OPTIONS_ABOUT); |
+ AddItemWithStringId(ABOUT_TRANSLATE, IDS_TRANSLATE_INFOBAR_OPTIONS_ABOUT); |
} |
OptionsMenuModel::~OptionsMenuModel() { |
@@ -70,13 +66,13 @@ OptionsMenuModel::~OptionsMenuModel() { |
bool OptionsMenuModel::IsCommandIdChecked(int command_id) const { |
switch (command_id) { |
- case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_LANG: |
+ case NEVER_TRANSLATE_LANGUAGE: |
return !translate_infobar_delegate_->IsTranslatableLanguageByPrefs(); |
- case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_SITE: |
+ case NEVER_TRANSLATE_SITE: |
return translate_infobar_delegate_->IsSiteBlacklisted(); |
- case IDC_TRANSLATE_OPTIONS_ALWAYS: |
+ case ALWAYS_TRANSLATE: |
return translate_infobar_delegate_->ShouldAlwaysTranslate(); |
default: |
@@ -88,11 +84,11 @@ bool OptionsMenuModel::IsCommandIdChecked(int command_id) const { |
bool OptionsMenuModel::IsCommandIdEnabled(int command_id) const { |
switch (command_id) { |
- case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_LANG : |
- case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_SITE : |
+ case NEVER_TRANSLATE_LANGUAGE: |
+ case NEVER_TRANSLATE_SITE: |
return !translate_infobar_delegate_->ShouldAlwaysTranslate(); |
- case IDC_TRANSLATE_OPTIONS_ALWAYS : |
+ case ALWAYS_TRANSLATE: |
return (translate_infobar_delegate_->IsTranslatableLanguageByPrefs() && |
!translate_infobar_delegate_->IsSiteBlacklisted()); |
@@ -103,29 +99,30 @@ bool OptionsMenuModel::IsCommandIdEnabled(int command_id) const { |
} |
bool OptionsMenuModel::GetAcceleratorForCommandId( |
- int command_id, ui::Accelerator* accelerator) { |
+ int command_id, |
+ ui::Accelerator* accelerator) { |
return false; |
} |
void OptionsMenuModel::ExecuteCommand(int command_id, int event_flags) { |
switch (command_id) { |
- case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_LANG: |
+ case NEVER_TRANSLATE_LANGUAGE: |
translate_infobar_delegate_->ToggleTranslatableLanguageByPrefs(); |
break; |
- case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_SITE: |
+ case NEVER_TRANSLATE_SITE: |
translate_infobar_delegate_->ToggleSiteBlacklist(); |
break; |
- case IDC_TRANSLATE_OPTIONS_ALWAYS: |
+ case ALWAYS_TRANSLATE: |
translate_infobar_delegate_->ToggleAlwaysTranslate(); |
break; |
- case IDC_TRANSLATE_REPORT_BAD_LANGUAGE_DETECTION: |
+ case REPORT_BAD_DETECTION: |
translate_infobar_delegate_->ReportLanguageDetectionError(); |
break; |
- case IDC_TRANSLATE_OPTIONS_ABOUT: { |
+ case ABOUT_TRANSLATE: { |
TranslateDriver* translate_driver = |
translate_infobar_delegate_->GetTranslateDriver(); |
if (translate_driver) |