Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: chrome/browser/chromeos/options/language_config_view.h

Issue 6336005: Remove unused language options code, which has been superseded by DOMUI. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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_CHROMEOS_OPTIONS_LANGUAGE_CONFIG_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CONFIG_VIEW_H_
7 #pragma once
8
9 #include <map>
10 #include <set>
11 #include <string>
12
13 #include "base/compiler_specific.h"
14 #include "chrome/browser/chromeos/options/language_config_model.h"
15 #include "chrome/browser/ui/views/options/options_page_view.h"
16 #include "ui/base/models/table_model.h"
17 #include "views/controls/button/native_button.h"
18 #include "views/controls/combobox/combobox.h"
19 #include "views/controls/label.h"
20 #include "views/controls/table/table_view2.h"
21 #include "views/controls/table/table_view_observer.h"
22 #include "views/grid_layout.h"
23 #include "views/window/dialog_delegate.h"
24
25 namespace chromeos {
26
27 class InputMethodButton;
28 class InputMethodCheckbox;
29 class PreferredLanguageTableModel;
30
31 // A dialog box for configuring the languages.
32 class LanguageConfigView : public ui::TableModel,
33 public views::ButtonListener,
34 public views::Combobox::Listener,
35 public views::DialogDelegate,
36 public views::TableViewObserver,
37 public OptionsPageView {
38 public:
39 explicit LanguageConfigView(Profile* profile);
40 virtual ~LanguageConfigView();
41
42 // views::ButtonListener overrides.
43 virtual void ButtonPressed(views::Button* sender,
44 const views::Event& event);
45
46 // views::DialogDelegate overrides.
47 virtual bool IsModal() const { return true; }
48 virtual views::View* GetContentsView() { return this; }
49 virtual std::wstring GetDialogButtonLabel(
50 MessageBoxFlags::DialogButton button) const;
51 virtual int GetDialogButtons() const {
52 return MessageBoxFlags::DIALOGBUTTON_OK;
53 }
54 virtual std::wstring GetWindowTitle() const;
55
56 // views::View overrides:
57 virtual void Layout();
58 virtual gfx::Size GetPreferredSize();
59
60 // views::TableViewObserver overrides:
61 virtual void OnSelectionChanged();
62
63 // TableModel overrides:
64 // To workaround crbug.com/38266, implement TreeModel as part of
65 // LanguageConfigView class, rather than a separate class.
66 // TODO(satorux): Implement TableModel as a separate class once the bug
67 // is fixed.
68 virtual string16 GetText(int row, int column_id) OVERRIDE;
69 virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE;
70 virtual int RowCount() OVERRIDE;
71
72 // views::Combobox::Listener overrides:
73 virtual void ItemChanged(views::Combobox* combobox,
74 int prev_index,
75 int new_index);
76
77 // OptionsPageView overrides.
78 virtual void InitControlLayout();
79
80 // Shows the language config dialog in a new window.
81 static void Show(Profile* profile, gfx::NativeWindow parent);
82
83 private:
84 // Initializes the input method config view.
85 void InitInputMethodConfigViewMap();
86
87 // Invoked when a language is added by the add combobox.
88 void OnAddLanguage(const std::string& language_code);
89
90 // Invoked when a language is removed by the remove button.
91 void OnRemoveLanguage();
92
93 // Resets the add language combobox to the initial "Add language" state.
94 void ResetAddLanguageCombobox();
95
96 // Creates the contents on the left, including the language table.
97 views::View* CreateContentsOnLeft();
98
99 // Creates the contents on the bottom, including the add language button.
100 views::View* CreateContentsOnBottom();
101
102 // Creates the per-language config view.
103 views::View* CreatePerLanguageConfigView(const std::string& language_code);
104
105 // Adds the UI language section in the per-language config view.
106 void AddUiLanguageSection(const std::string& language_code,
107 views::GridLayout* layout);
108
109 // Adds the input method section in the per-language config view.
110 void AddInputMethodSection(const std::string& language_code,
111 views::GridLayout* layout);
112
113 // Creates the input method config view based on the given |input_method_id|.
114 // Returns NULL if the config view is not found.
115 views::DialogDelegate* CreateInputMethodConfigureView(
116 const std::string& input_method_id);
117
118 // If there is only one input method left, disable the selected method.
119 // This is done to prevent the user from disabling all input methods.
120 void MaybeDisableLastCheckbox();
121
122 // Enable all input method checkboxes.
123 void EnableAllCheckboxes();
124
125 // The model of the view.
126 LanguageConfigModel model_;
127
128 // The map of the input method id to a pointer to the function for
129 // creating the input method configuration dialog.
130 typedef views::DialogDelegate* (*CreateDialogDelegateFunction)(Profile*);
131 typedef std::map<std::string,
132 CreateDialogDelegateFunction> InputMethodConfigViewMap;
133 InputMethodConfigViewMap input_method_config_view_map_;
134
135 // The checkboxes for activating input methods for a language.
136 std::set<InputMethodCheckbox*> input_method_checkboxes_;
137
138 views::View* root_container_;
139 views::View* right_container_;
140 views::NativeButton* remove_language_button_;
141 views::TableView2* preferred_language_table_;
142 scoped_ptr<AddLanguageComboboxModel> add_language_combobox_model_;
143 views::Combobox* add_language_combobox_;
144
145 DISALLOW_COPY_AND_ASSIGN(LanguageConfigView);
146 };
147
148 } // namespace chromeos
149
150 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CONFIG_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/language_config_util.h ('k') | chrome/browser/chromeos/options/language_config_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698