Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / translate / language_combobox_model.cc
blob182c12d9f2ba410d88de7b75a0b90a6da3004ac1
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/translate/language_combobox_model.h"
7 #include "chrome/browser/ui/translate/translate_bubble_model.h"
9 LanguageComboboxModel::LanguageComboboxModel(
10 int default_index,
11 TranslateBubbleModel* model)
12 : default_index_(default_index < 0 ? 0 : default_index),
13 model_(model) {
14 // view::Combobox can't treate an negative index, but |default_index| can be
15 // negative when, for example, the page's language can't be detected.
18 LanguageComboboxModel::~LanguageComboboxModel() {
21 int LanguageComboboxModel::GetItemCount() const {
22 return model_->GetNumberOfLanguages();
25 base::string16 LanguageComboboxModel::GetItemAt(int index) {
26 return model_->GetLanguageNameAt(index);
29 bool LanguageComboboxModel::IsItemSeparatorAt(int index) {
30 return false;
33 int LanguageComboboxModel::GetDefaultIndex() const {
34 return default_index_;