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

Side by Side Diff: chrome/browser/views/autofill_profiles_view_win.h

Issue 2801020: UI changes to Autofill dialogs according to the latest mocks... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_VIEWS_AUTOFILL_PROFILES_VIEW_WIN_H_ 5 #ifndef CHROME_BROWSER_VIEWS_AUTOFILL_PROFILES_VIEW_WIN_H_
6 #define CHROME_BROWSER_VIEWS_AUTOFILL_PROFILES_VIEW_WIN_H_ 6 #define CHROME_BROWSER_VIEWS_AUTOFILL_PROFILES_VIEW_WIN_H_
7 7
8 #include <list> 8 #include <list>
9 #include <vector> 9 #include <vector>
10 10
11 #include "app/combobox_model.h" 11 #include "app/combobox_model.h"
12 #include "app/table_model.h" 12 #include "app/table_model.h"
13 #include "chrome/browser/autofill/autofill_dialog.h" 13 #include "chrome/browser/autofill/autofill_dialog.h"
14 #include "chrome/browser/autofill/autofill_profile.h" 14 #include "chrome/browser/autofill/autofill_profile.h"
15 #include "chrome/browser/autofill/personal_data_manager.h" 15 #include "chrome/browser/autofill/personal_data_manager.h"
16 #include "views/controls/combobox/combobox.h" 16 #include "views/controls/combobox/combobox.h"
17 #include "views/controls/link.h" 17 #include "views/controls/link.h"
18 #include "views/controls/table/table_view_observer.h" 18 #include "views/controls/table/table_view_observer.h"
19 #include "views/controls/textfield/textfield.h" 19 #include "views/controls/textfield/textfield.h"
20 #include "views/focus/focus_manager.h" 20 #include "views/focus/focus_manager.h"
21 #include "views/view.h" 21 #include "views/view.h"
22 #include "views/window/dialog_delegate.h" 22 #include "views/window/dialog_delegate.h"
23 23
24 namespace views { 24 namespace views {
25 class Checkbox;
25 class GridLayout; 26 class GridLayout;
26 class ImageButton; 27 class ImageButton;
27 class Label; 28 class Label;
28 class RadioButton; 29 class RadioButton;
29 class TableView; 30 class TableView;
30 class TextButton; 31 class TextButton;
31 } 32 }
32 33
33 class PrefService; 34 class PrefService;
34 class SkBitmap; 35 class SkBitmap;
(...skipping 18 matching lines...) Expand all
53 public views::LinkController, 54 public views::LinkController,
54 public views::FocusChangeListener, 55 public views::FocusChangeListener,
55 public views::TableViewObserver, 56 public views::TableViewObserver,
56 public PersonalDataManager::Observer { 57 public PersonalDataManager::Observer {
57 public: 58 public:
58 virtual ~AutoFillProfilesView(); 59 virtual ~AutoFillProfilesView();
59 60
60 static int Show(gfx::NativeWindow parent, 61 static int Show(gfx::NativeWindow parent,
61 AutoFillDialogObserver* observer, 62 AutoFillDialogObserver* observer,
62 PersonalDataManager* personal_data_manager, 63 PersonalDataManager* personal_data_manager,
64 Profile* profile,
63 PrefService* preferences, 65 PrefService* preferences,
64 AutoFillProfile* imported_profile, 66 AutoFillProfile* imported_profile,
65 CreditCard* imported_credit_card); 67 CreditCard* imported_credit_card);
66 68
67 protected: 69 protected:
68 // forward declaration. This struct defined further down. 70 // forward declaration. This struct defined further down.
69 struct EditableSetInfo; 71 struct EditableSetInfo;
70 // Called when 'Add Address' (|group_type| is 72 // Called when 'Add Address' (|group_type| is
71 // ContentListTableModel::kAddressGroup) or 'Add Credit Card' (|group_type| is 73 // ContentListTableModel::kAddressGroup) or 'Add Credit Card' (|group_type| is
72 // ContentListTableModel::kCreditCardGroup) is clicked. 74 // ContentListTableModel::kCreditCardGroup) is clicked.
73 void AddClicked(int group_type); 75 void AddClicked(int group_type);
74 // Called when 'Edit...' is clicked. 76 // Called when 'Edit...' is clicked.
75 void EditClicked(); 77 void EditClicked();
76 // Called when 'Remove' is clicked. 78 // Called when 'Remove' is clicked.
77 void DeleteClicked(); 79 void DeleteClicked();
78 80
79 // Updates state of the buttons. 81 // Updates state of the buttons.
80 void UpdateButtonState(); 82 void UpdateButtonState();
81 83
84 // Updates inferred labels.
85 void UpdateProfileLabels();
86
82 // Following two functions are called from opened child dialog to 87 // Following two functions are called from opened child dialog to
83 // disable/enable buttons. 88 // disable/enable buttons.
84 void ChildWindowOpened(); 89 void ChildWindowOpened();
85 void ChildWindowClosed(); 90 void ChildWindowClosed();
86 91
87 // Returns warning bitmap to set on warning indicator. If |good| is true it 92 // Returns warning bitmap to set on warning indicator. If |good| is true it
88 // returns the bitmap idicating validity, if false - indicating error. 93 // returns the bitmap idicating validity, if false - indicating error.
89 // Caller owns the bitmap after the call. 94 // Caller owns the bitmap after the call.
90 SkBitmap* GetWarningBimap(bool good); 95 SkBitmap* GetWarningBimap(bool good);
91 96
(...skipping 29 matching lines...) Expand all
121 126
122 // views::FocusChangeListener methods: 127 // views::FocusChangeListener methods:
123 virtual void FocusWillChange(views::View* focused_before, 128 virtual void FocusWillChange(views::View* focused_before,
124 views::View* focused_now); 129 views::View* focused_now);
125 130
126 // views::TableViewObserver methods: 131 // views::TableViewObserver methods:
127 virtual void OnSelectionChanged(); 132 virtual void OnSelectionChanged();
128 virtual void OnDoubleClick(); 133 virtual void OnDoubleClick();
129 134
130 // PersonalDataManager::Observer methods: 135 // PersonalDataManager::Observer methods:
131 void OnPersonalDataLoaded(); 136 virtual void OnPersonalDataLoaded();
132 137
133 // Helper structure to keep info on one address or credit card. 138 // Helper structure to keep info on one address or credit card.
134 // Keeps info on one item in EditableSetViewContents. 139 // Keeps info on one item in EditableSetViewContents.
135 // Also keeps info on opened status. Allows to quickly add and delete items, 140 // Also keeps info on opened status. Allows to quickly add and delete items,
136 // and then rebuild EditableSetViewContents. 141 // and then rebuild EditableSetViewContents.
137 struct EditableSetInfo { 142 struct EditableSetInfo {
138 bool is_address; 143 bool is_address;
139 bool has_credit_card_number_been_edited; 144 bool has_credit_card_number_been_edited;
140 // If |is_address| is true |address| has some data and |credit_card| 145 // If |is_address| is true |address| has some data and |credit_card|
141 // is empty, and vice versa 146 // is empty, and vice versa
(...skipping 19 matching lines...) Expand all
161 166
162 struct FocusedItem { 167 struct FocusedItem {
163 int group; 168 int group;
164 int item; 169 int item;
165 FocusedItem() : group(kNoItemFocused), item(kNoItemFocused) {} 170 FocusedItem() : group(kNoItemFocused), item(kNoItemFocused) {}
166 FocusedItem(int g, int i) : group(g), item(i) {} 171 FocusedItem(int g, int i) : group(g), item(i) {}
167 }; 172 };
168 173
169 AutoFillProfilesView(AutoFillDialogObserver* observer, 174 AutoFillProfilesView(AutoFillDialogObserver* observer,
170 PersonalDataManager* personal_data_manager, 175 PersonalDataManager* personal_data_manager,
176 Profile* profile,
171 PrefService* preferences, 177 PrefService* preferences,
172 AutoFillProfile* imported_profile, 178 AutoFillProfile* imported_profile,
173 CreditCard* imported_credit_card); 179 CreditCard* imported_credit_card);
174 void Init(); 180 void Init();
175 181
176 void GetData(); 182 void GetData();
177 bool IsDataReady() const; 183 bool IsDataReady() const;
178 184
179 // Rebuilds the view by deleting and re-creating sub-views 185 // Rebuilds the view by deleting and re-creating sub-views
180 void RebuildView(const FocusedItem& new_focus_index); 186 void RebuildView(const FocusedItem& new_focus_index);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 const string16& new_contents); 272 const string16& new_contents);
267 virtual bool HandleKeystroke(views::Textfield* sender, 273 virtual bool HandleKeystroke(views::Textfield* sender,
268 const views::Textfield::Keystroke& keystroke); 274 const views::Textfield::Keystroke& keystroke);
269 275
270 // views::Combobox::Listener methods: 276 // views::Combobox::Listener methods:
271 virtual void ItemChanged(views::Combobox* combo_box, 277 virtual void ItemChanged(views::Combobox* combo_box,
272 int prev_index, 278 int prev_index,
273 int new_index); 279 int new_index);
274 private: 280 private:
275 enum TextFields { 281 enum TextFields {
276 TEXT_LABEL,
277 TEXT_FULL_NAME, 282 TEXT_FULL_NAME,
278 TEXT_COMPANY, 283 TEXT_COMPANY,
279 TEXT_EMAIL, 284 TEXT_EMAIL,
280 TEXT_ADDRESS_LINE_1, 285 TEXT_ADDRESS_LINE_1,
281 TEXT_ADDRESS_LINE_2, 286 TEXT_ADDRESS_LINE_2,
282 TEXT_ADDRESS_CITY, 287 TEXT_ADDRESS_CITY,
283 TEXT_ADDRESS_STATE, 288 TEXT_ADDRESS_STATE,
284 TEXT_ADDRESS_ZIP, 289 TEXT_ADDRESS_ZIP,
285 TEXT_ADDRESS_COUNTRY, 290 TEXT_ADDRESS_COUNTRY,
286 TEXT_PHONE_PHONE, 291 TEXT_PHONE_PHONE,
287 TEXT_FAX_PHONE, 292 TEXT_FAX_PHONE,
288 TEXT_CC_NAME, 293 TEXT_CC_NAME,
289 TEXT_CC_NUMBER, 294 TEXT_CC_NUMBER,
290 // must be last 295 // must be last
291 MAX_TEXT_FIELD 296 MAX_TEXT_FIELD
292 }; 297 };
293 298
294 void InitTitle(views::GridLayout* layout);
295 void InitAddressFields(views::GridLayout* layout); 299 void InitAddressFields(views::GridLayout* layout);
296 void InitCreditCardFields(views::GridLayout* layout); 300 void InitCreditCardFields(views::GridLayout* layout);
297 void InitLayoutGrid(views::GridLayout* layout); 301 void InitLayoutGrid(views::GridLayout* layout);
298 views::Label* CreateLeftAlignedLabel(int label_id); 302 views::Label* CreateLeftAlignedLabel(int label_id);
299 303
300 bool LabelValid() const;
301 void UpdateButtons(); 304 void UpdateButtons();
302 305
303 void UpdateContentsPhoneViews(TextFields field, 306 void UpdateContentsPhoneViews(TextFields field,
304 views::Textfield* sender, 307 views::Textfield* sender,
305 const string16& new_contents); 308 const string16& new_contents);
306 309
307 views::Textfield* text_fields_[MAX_TEXT_FIELD]; 310 views::Textfield* text_fields_[MAX_TEXT_FIELD];
308 std::vector<EditableSetInfo>::iterator editable_fields_set_; 311 std::vector<EditableSetInfo>::iterator editable_fields_set_;
309 EditableSetInfo temporary_info_; 312 EditableSetInfo temporary_info_;
310 views::ImageButton* label_warning_button_;
311 AutoFillProfilesView* observer_; 313 AutoFillProfilesView* observer_;
312 AddressComboBoxModel* billing_model_; 314 AddressComboBoxModel* billing_model_;
313 views::Combobox* combo_box_billing_; 315 views::Combobox* combo_box_billing_;
314 scoped_ptr<StringVectorComboboxModel> combo_box_model_month_; 316 scoped_ptr<StringVectorComboboxModel> combo_box_model_month_;
315 views::Combobox* combo_box_month_; 317 views::Combobox* combo_box_month_;
316 scoped_ptr<StringVectorComboboxModel> combo_box_model_year_; 318 scoped_ptr<StringVectorComboboxModel> combo_box_model_year_;
317 views::Combobox* combo_box_year_; 319 views::Combobox* combo_box_year_;
318 bool new_item_; 320 bool new_item_;
319 std::vector<PhoneSubView*> phone_sub_views_; 321 std::vector<PhoneSubView*> phone_sub_views_;
320 322
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // times if several combo boxes relying on the model. 356 // times if several combo boxes relying on the model.
355 // Model does not own |combo_box|. 357 // Model does not own |combo_box|.
356 void UsedWithComboBox(views::Combobox *combo_box); 358 void UsedWithComboBox(views::Combobox *combo_box);
357 359
358 // Need to be called when comboboxes are destroyed. 360 // Need to be called when comboboxes are destroyed.
359 void ClearComboBoxes() { combo_boxes_.clear(); } 361 void ClearComboBoxes() { combo_boxes_.clear(); }
360 362
361 // Call this function if one of the labels has changed 363 // Call this function if one of the labels has changed
362 void LabelChanged(); 364 void LabelChanged();
363 365
364 // Gets index of the string in the model or -1 if not found. 366 // Gets index of the item in the model or -1 if not found.
365 int GetIndex(const string16 &s); 367 int GetIndex(int unique_id);
366 368
367 // ComboboxModel methods, public as they used from EditableSetViewContents 369 // ComboboxModel methods, public as they used from EditableSetViewContents
368 virtual int GetItemCount(); 370 virtual int GetItemCount();
369 virtual std::wstring GetItemAt(int index); 371 virtual std::wstring GetItemAt(int index);
370 372
371 private: 373 private:
372 std::list<views::Combobox *> combo_boxes_; 374 std::list<views::Combobox *> combo_boxes_;
373 const std::vector<EditableSetInfo>* address_labels_; 375 const std::vector<EditableSetInfo>* address_labels_;
374 bool is_billing_; 376 bool is_billing_;
375 377
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 private: 432 private:
431 std::vector<EditableSetInfo>* profiles_; 433 std::vector<EditableSetInfo>* profiles_;
432 std::vector<EditableSetInfo>* credit_cards_; 434 std::vector<EditableSetInfo>* credit_cards_;
433 TableModelObserver* observer_; 435 TableModelObserver* observer_;
434 436
435 DISALLOW_COPY_AND_ASSIGN(ContentListTableModel); 437 DISALLOW_COPY_AND_ASSIGN(ContentListTableModel);
436 }; 438 };
437 439
438 AutoFillDialogObserver* observer_; 440 AutoFillDialogObserver* observer_;
439 PersonalDataManager* personal_data_manager_; 441 PersonalDataManager* personal_data_manager_;
442 Profile* profile_;
440 PrefService* preferences_; 443 PrefService* preferences_;
441 std::vector<EditableSetInfo> profiles_set_; 444 std::vector<EditableSetInfo> profiles_set_;
442 std::vector<EditableSetInfo> credit_card_set_; 445 std::vector<EditableSetInfo> credit_card_set_;
443 446
444 AddressComboBoxModel billing_model_; 447 AddressComboBoxModel billing_model_;
445 448
449 views::Checkbox* enable_auto_fill_button_;
446 views::Button* add_address_button_; 450 views::Button* add_address_button_;
447 views::Button* add_credit_card_button_; 451 views::Button* add_credit_card_button_;
448 views::Button* edit_button_; 452 views::Button* edit_button_;
449 views::Button* remove_button_; 453 views::Button* remove_button_;
450 views::TableView* scroll_view_; 454 views::TableView* scroll_view_;
451 scoped_ptr<ContentListTableModel> table_model_; 455 scoped_ptr<ContentListTableModel> table_model_;
452 views::FocusManager* focus_manager_; 456 views::FocusManager* focus_manager_;
453 bool child_dialog_opened_; 457 bool child_dialog_opened_;
454 458
455 static AutoFillProfilesView* instance_; 459 static AutoFillProfilesView* instance_;
456 460
457 DISALLOW_COPY_AND_ASSIGN(AutoFillProfilesView); 461 DISALLOW_COPY_AND_ASSIGN(AutoFillProfilesView);
458 }; 462 };
459 463
460 #endif // CHROME_BROWSER_VIEWS_AUTOFILL_PROFILES_VIEW_WIN_H_ 464 #endif // CHROME_BROWSER_VIEWS_AUTOFILL_PROFILES_VIEW_WIN_H_
461 465
OLDNEW
« no previous file with comments | « chrome/app/resources/locale_settings.grd ('k') | chrome/browser/views/autofill_profiles_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698