ExtensionSyncService: listen for relevant changes instead of being explicitly called...
[chromium-blink-merge.git] / chrome / browser / ui / translate / language_combobox_model.cc
blobfcd2e267aeb7402437e3bcdb4f6b2cc524cec993
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 int LanguageComboboxModel::GetDefaultIndex() const {
30 return default_index_;