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

Side by Side Diff: chrome/browser/autofill/autofill_dialog_gtk.cc

Issue 2818033: AutoFill: Aggregate profile data. Remove the AutoFill InfoBar. (Closed)
Patch Set: Comment. 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
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 #include "chrome/browser/autofill/autofill_dialog.h" 5 #include "chrome/browser/autofill/autofill_dialog.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "app/l10n_util.h" 12 #include "app/l10n_util.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/autofill/autofill_manager.h" 16 #include "chrome/browser/autofill/autofill_manager.h"
17 #include "chrome/browser/autofill/autofill_profile.h" 17 #include "chrome/browser/autofill/autofill_profile.h"
18 #include "chrome/browser/autofill/credit_card.h" 18 #include "chrome/browser/autofill/credit_card.h"
19 #include "chrome/browser/autofill/form_group.h" 19 #include "chrome/browser/autofill/form_group.h"
20 #include "chrome/browser/autofill/personal_data_manager.h" 20 #include "chrome/browser/autofill/personal_data_manager.h"
21 #include "chrome/browser/autofill/phone_number.h" 21 #include "chrome/browser/autofill/phone_number.h"
22 #include "chrome/browser/browser.h" 22 #include "chrome/browser/browser.h"
23 #include "chrome/browser/browser_list.h" 23 #include "chrome/browser/browser_list.h"
24 #include "chrome/browser/gtk/gtk_chrome_link_button.h" 24 #include "chrome/browser/gtk/gtk_chrome_link_button.h"
25 #include "chrome/browser/gtk/gtk_util.h" 25 #include "chrome/browser/gtk/gtk_util.h"
26 #include "chrome/browser/gtk/options/options_layout_gtk.h" 26 #include "chrome/browser/gtk/options/options_layout_gtk.h"
27 #include "chrome/browser/pref_service.h"
28 #include "chrome/browser/profile.h" 27 #include "chrome/browser/profile.h"
29 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
30 #include "gfx/gtk_util.h" 29 #include "gfx/gtk_util.h"
31 #include "grit/chromium_strings.h" 30 #include "grit/chromium_strings.h"
32 #include "grit/generated_resources.h" 31 #include "grit/generated_resources.h"
33 #include "grit/locale_settings.h" 32 #include "grit/locale_settings.h"
34 33
35 namespace { 34 namespace {
36 35
37 // The name of the object property used to store an entry widget pointer on 36 // The name of the object property used to store an entry widget pointer on
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 222
224 //////////////////////////////////////////////////////////////////////////////// 223 ////////////////////////////////////////////////////////////////////////////////
225 // AutoFillDialog 224 // AutoFillDialog
226 // 225 //
227 // The contents of the AutoFill dialog. This dialog allows users to add, edit 226 // The contents of the AutoFill dialog. This dialog allows users to add, edit
228 // and remove AutoFill profiles. 227 // and remove AutoFill profiles.
229 class AutoFillDialog : public PersonalDataManager::Observer { 228 class AutoFillDialog : public PersonalDataManager::Observer {
230 public: 229 public:
231 AutoFillDialog(AutoFillDialogObserver* observer, 230 AutoFillDialog(AutoFillDialogObserver* observer,
232 PersonalDataManager* personal_data_manager, 231 PersonalDataManager* personal_data_manager,
233 PrefService* pref_service,
234 AutoFillProfile* imported_profile, 232 AutoFillProfile* imported_profile,
235 CreditCard* imported_credit_card); 233 CreditCard* imported_credit_card);
236 ~AutoFillDialog(); 234 ~AutoFillDialog();
237 235
238 // PersonalDataManager::Observer implementation: 236 // PersonalDataManager::Observer implementation:
239 void OnPersonalDataLoaded(); 237 void OnPersonalDataLoaded();
240 238
241 // Shows the AutoFill dialog. 239 // Shows the AutoFill dialog.
242 void Show(); 240 void Show();
243 241
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 // if the address is not found. 308 // if the address is not found.
311 int FindIndexOfAddress(string16 billing_address); 309 int FindIndexOfAddress(string16 billing_address);
312 310
313 // Our observer. May not be NULL. 311 // Our observer. May not be NULL.
314 AutoFillDialogObserver* observer_; 312 AutoFillDialogObserver* observer_;
315 313
316 // The personal data manager, used to load AutoFill profiles and credit cards. 314 // The personal data manager, used to load AutoFill profiles and credit cards.
317 // Unowned pointer, may not be NULL. 315 // Unowned pointer, may not be NULL.
318 PersonalDataManager* personal_data_; 316 PersonalDataManager* personal_data_;
319 317
320 // The preference service. Unowned pointer, may not be NULL.
321 PrefService* pref_service_;
322
323 // The imported profile. May be NULL. 318 // The imported profile. May be NULL.
324 AutoFillProfile* imported_profile_; 319 AutoFillProfile* imported_profile_;
325 320
326 // The imported credit card. May be NULL. 321 // The imported credit card. May be NULL.
327 CreditCard* imported_credit_card_; 322 CreditCard* imported_credit_card_;
328 323
329 // The list of current AutoFill profiles. 324 // The list of current AutoFill profiles.
330 std::vector<AutoFillProfile> profiles_; 325 std::vector<AutoFillProfile> profiles_;
331 326
332 // The list of current AutoFill credit cards. 327 // The list of current AutoFill credit cards.
(...skipping 15 matching lines...) Expand all
348 GtkWidget* creditcards_vbox_; 343 GtkWidget* creditcards_vbox_;
349 344
350 DISALLOW_COPY_AND_ASSIGN(AutoFillDialog); 345 DISALLOW_COPY_AND_ASSIGN(AutoFillDialog);
351 }; 346 };
352 347
353 // The singleton AutoFill dialog object. 348 // The singleton AutoFill dialog object.
354 static AutoFillDialog* dialog = NULL; 349 static AutoFillDialog* dialog = NULL;
355 350
356 AutoFillDialog::AutoFillDialog(AutoFillDialogObserver* observer, 351 AutoFillDialog::AutoFillDialog(AutoFillDialogObserver* observer,
357 PersonalDataManager* personal_data_manager, 352 PersonalDataManager* personal_data_manager,
358 PrefService* pref_service,
359 AutoFillProfile* imported_profile, 353 AutoFillProfile* imported_profile,
360 CreditCard* imported_credit_card) 354 CreditCard* imported_credit_card)
361 : observer_(observer), 355 : observer_(observer),
362 personal_data_(personal_data_manager), 356 personal_data_(personal_data_manager),
363 pref_service_(pref_service),
364 imported_profile_(imported_profile), 357 imported_profile_(imported_profile),
365 imported_credit_card_(imported_credit_card) { 358 imported_credit_card_(imported_credit_card) {
366 DCHECK(observer_); 359 DCHECK(observer_);
367 DCHECK(personal_data_); 360 DCHECK(personal_data_);
368 DCHECK(pref_service_);
369 361
370 InitializeWidgets(); 362 InitializeWidgets();
371 LoadAutoFillData(); 363 LoadAutoFillData();
372 364
373 gtk_util::ShowDialogWithLocalizedSize(dialog_, 365 gtk_util::ShowDialogWithLocalizedSize(dialog_,
374 IDS_AUTOFILL_DIALOG_WIDTH_CHARS, 366 IDS_AUTOFILL_DIALOG_WIDTH_CHARS,
375 IDS_AUTOFILL_DIALOG_HEIGHT_LINES, 367 IDS_AUTOFILL_DIALOG_HEIGHT_LINES,
376 true); 368 true);
377 } 369 }
378 370
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 /////////////////////////////////////////////////////////////////////////////// 976 ///////////////////////////////////////////////////////////////////////////////
985 // Factory/finder method: 977 // Factory/finder method:
986 978
987 void ShowAutoFillDialog(gfx::NativeView parent, 979 void ShowAutoFillDialog(gfx::NativeView parent,
988 AutoFillDialogObserver* observer, 980 AutoFillDialogObserver* observer,
989 Profile* profile, 981 Profile* profile,
990 AutoFillProfile* imported_profile, 982 AutoFillProfile* imported_profile,
991 CreditCard* imported_credit_card) { 983 CreditCard* imported_credit_card) {
992 DCHECK(profile); 984 DCHECK(profile);
993 985
994 // It's possible we haven't shown the InfoBar yet, but if the user is in the
995 // AutoFill dialog, she doesn't need to be asked to enable or disable
996 // AutoFill.
997 profile->GetPrefs()->SetBoolean(prefs::kAutoFillInfoBarShown, true);
998
999 if (!dialog) { 986 if (!dialog) {
1000 dialog = new AutoFillDialog(observer, 987 dialog = new AutoFillDialog(observer,
1001 profile->GetPersonalDataManager(), 988 profile->GetPersonalDataManager(),
1002 profile->GetPrefs(),
1003 imported_profile, 989 imported_profile,
1004 imported_credit_card); 990 imported_credit_card);
1005 } 991 }
1006 dialog->Show(); 992 dialog->Show();
1007 } 993 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm ('k') | chrome/browser/autofill/autofill_dialog_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698