language_order_table_model.h revision 513209b27ff55e2841eac0e4120199c23acce758
1// Copyright (c) 2009 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. 4 5#ifndef CHROME_BROWSER_LANGUAGE_ORDER_TABLE_MODEL_H_ 6#define CHROME_BROWSER_LANGUAGE_ORDER_TABLE_MODEL_H_ 7#pragma once 8 9#include <string> 10#include <vector> 11 12#include "app/table_model.h" 13#include "base/basictypes.h" 14 15class TableModelObserver; 16 17class LanguageOrderTableModel : public TableModel { 18 public: 19 LanguageOrderTableModel(); 20 21 virtual ~LanguageOrderTableModel(); 22 23 // Set Language List. 24 void SetAcceptLanguagesString(const std::string& language_list); 25 26 // Add at the end. Return true if the language was added. 27 bool Add(const std::string& language); 28 29 // Removes the entry at the specified index. 30 void Remove(int index); 31 32 // Returns index corresponding to a given language. Returns -1 if the 33 // language is not found. 34 int GetIndex(const std::string& language); 35 36 // Move down the entry at the specified index. 37 void MoveDown(int index); 38 39 // Move up the entry at the specified index. 40 void MoveUp(int index); 41 42 // Returns the set of languagess this model contains. 43 std::string GetLanguageList(); 44 45 // TableModel overrides: 46 virtual int RowCount(); 47 virtual std::wstring GetText(int row, int column_id); 48 virtual void SetObserver(TableModelObserver* observer); 49 50 private: 51 // Set of entries we're showing. 52 std::vector<std::string> languages_; 53 std::string comma_separated_language_list_; 54 55 TableModelObserver* observer_; 56 57 DISALLOW_COPY_AND_ASSIGN(LanguageOrderTableModel); 58}; 59 60#endif // CHROME_BROWSER_LANGUAGE_ORDER_TABLE_MODEL_H_ 61