blob: 4364e07e3214473e09293a61ac832d6a311a11f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// 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 "app/l10n_util.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/translate/translate_infobars_delegates.h"
#include "grit/generated_resources.h"
OptionsMenuModel::OptionsMenuModel(menus::SimpleMenuModel::Delegate* delegate,
TranslateInfoBarDelegate* translate_delegate)
: menus::SimpleMenuModel(delegate) {
string16 original_language =
translate_delegate->GetDisplayNameForLocale(
translate_delegate->original_lang_code());
TranslateInfoBarDelegate::TranslateState state = translate_delegate->state();
if (state == TranslateInfoBarDelegate::kBeforeTranslate) {
AddCheckItem(IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_LANG,
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));
} else if (state == TranslateInfoBarDelegate::kAfterTranslate) {
string16 target_language =
translate_delegate->GetDisplayNameForLocale(
translate_delegate->target_lang_code());
AddCheckItem(IDC_TRANSLATE_OPTIONS_ALWAYS,
l10n_util::GetStringFUTF16(IDS_TRANSLATE_INFOBAR_OPTIONS_ALWAYS,
original_language, target_language));
}
AddItemWithStringId(IDC_TRANSLATE_OPTIONS_ABOUT,
IDS_TRANSLATE_INFOBAR_OPTIONS_ABOUT);
}
OptionsMenuModel::~OptionsMenuModel() {
}
|