summaryrefslogtreecommitdiffstats
path: root/chrome/browser/language_order_table_model.h
diff options
context:
space:
mode:
authormhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-28 01:31:55 +0000
committermhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-28 01:31:55 +0000
commit736388d4ce0e8b9fee9ae9ac58d50027d290539b (patch)
treed84002565730958c62d71f69cd11b2efda2a79f1 /chrome/browser/language_order_table_model.h
parent1eaabcb4a8bf38a1ed8b260efe019d91f33dbeae (diff)
downloadchromium_src-736388d4ce0e8b9fee9ae9ac58d50027d290539b.zip
chromium_src-736388d4ce0e8b9fee9ae9ac58d50027d290539b.tar.gz
chromium_src-736388d4ce0e8b9fee9ae9ac58d50027d290539b.tar.bz2
Refactor out language models for linux gtk views preparation
There are models and an language array that are needed for the linux gtk views afaik. So extracting the classes from the windows specific code into separate files would allow code reusabiliy. BUG=13524 TEST=Windows Language Dialog functions properly. Review URL: http://codereview.chromium.org/151138 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21787 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/language_order_table_model.h')
-rw-r--r--chrome/browser/language_order_table_model.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/chrome/browser/language_order_table_model.h b/chrome/browser/language_order_table_model.h
new file mode 100644
index 0000000..327fe67
--- /dev/null
+++ b/chrome/browser/language_order_table_model.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2009 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.
+
+#ifndef CHROME_BROWSER_LANGUAGE_ORDER_TABLE_MODEL_H_
+#define CHROME_BROWSER_LANGUAGE_ORDER_TABLE_MODEL_H_
+
+#include <string>
+#include <vector>
+
+#include "app/table_model.h"
+#include "app/table_model_observer.h"
+
+class LanguageOrderTableModel : public TableModel {
+ public:
+ LanguageOrderTableModel();
+
+ // Set Language List.
+ void SetAcceptLanguagesString(const std::string& language_list);
+
+ // Add at the end.
+ void Add(const std::string& language);
+
+ // Removes the entry at the specified index.
+ void Remove(int index);
+
+ // Returns index corresponding to a given language. Returns -1 if the
+ // language is not found.
+ int GetIndex(const std::string& language);
+
+ // Move down the entry at the specified index.
+ void MoveDown(int index);
+
+ // Move up the entry at the specified index.
+ void MoveUp(int index);
+
+ // Returns the set of languagess this model contains.
+ std::string GetLanguageList() { return VectorToList(languages_); }
+
+ // TableModel overrides:
+ virtual int RowCount();
+ virtual std::wstring GetText(int row, int column_id);
+ virtual void SetObserver(TableModelObserver* observer);
+
+ private:
+ // This method converts a comma separated list to a vector of strings.
+ void ListToVector(const std::string& list,
+ std::vector<std::string>* vector);
+
+ // This method returns a comma separated string given a string vector.
+ std::string VectorToList(const std::vector<std::string>& vector);
+
+ // Set of entries we're showing.
+ std::vector<std::string> languages_;
+ std::string comma_separated_language_list_;
+
+ TableModelObserver* observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(LanguageOrderTableModel);
+};
+
+#endif // CHROME_BROWSER_LANGUAGE_ORDER_TABLE_MODEL_H_