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

Side by Side Diff: chrome/browser/ui/webui/options/autofill_options_handler.cc

Issue 7967024: Profile shouldn't own PersonalDataManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addresses isherman #11 Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 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 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/ui/webui/options/autofill_options_handler.h" 5 #include "chrome/browser/ui/webui/options/autofill_options_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/autofill/autofill_country.h" 14 #include "chrome/browser/autofill/autofill_country.h"
15 #include "chrome/browser/autofill/autofill_profile.h" 15 #include "chrome/browser/autofill/autofill_profile.h"
16 #include "chrome/browser/autofill/credit_card.h" 16 #include "chrome/browser/autofill/credit_card.h"
17 #include "chrome/browser/autofill/personal_data_manager.h" 17 #include "chrome/browser/autofill/personal_data_manager.h"
18 #include "chrome/browser/autofill/personal_data_manager_factory.h"
18 #include "chrome/browser/autofill/phone_number_i18n.h" 19 #include "chrome/browser/autofill/phone_number_i18n.h"
19 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/webui/web_ui_util.h" 21 #include "chrome/browser/ui/webui/web_ui_util.h"
21 #include "chrome/common/guid.h" 22 #include "chrome/common/guid.h"
22 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
23 #include "grit/webkit_resources.h" 24 #include "grit/webkit_resources.h"
24 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
25 26
26 namespace { 27 namespace {
27 28
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 219
219 RegisterStrings(localized_strings, resources, arraysize(resources)); 220 RegisterStrings(localized_strings, resources, arraysize(resources));
220 RegisterTitle(localized_strings, "autofillOptionsPage", 221 RegisterTitle(localized_strings, "autofillOptionsPage",
221 IDS_AUTOFILL_OPTIONS_TITLE); 222 IDS_AUTOFILL_OPTIONS_TITLE);
222 223
223 SetAddressOverlayStrings(localized_strings); 224 SetAddressOverlayStrings(localized_strings);
224 SetCreditCardOverlayStrings(localized_strings); 225 SetCreditCardOverlayStrings(localized_strings);
225 } 226 }
226 227
227 void AutofillOptionsHandler::Initialize() { 228 void AutofillOptionsHandler::Initialize() {
228 personal_data_ = Profile::FromWebUI(web_ui_)->GetPersonalDataManager(); 229 personal_data_ = PersonalDataManagerFactory::GetForProfile(
230 Profile::FromWebUI(web_ui_));
229 personal_data_->SetObserver(this); 231 personal_data_->SetObserver(this);
230 232
231 LoadAutofillData(); 233 LoadAutofillData();
232 } 234 }
233 235
234 void AutofillOptionsHandler::RegisterMessages() { 236 void AutofillOptionsHandler::RegisterMessages() {
235 web_ui_->RegisterMessageCallback( 237 web_ui_->RegisterMessageCallback(
236 "removeAddress", 238 "removeAddress",
237 NewCallback(this, &AutofillOptionsHandler::RemoveAddress)); 239 NewCallback(this, &AutofillOptionsHandler::RemoveAddress));
238 web_ui_->RegisterMessageCallback( 240 web_ui_->RegisterMessageCallback(
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 void AutofillOptionsHandler::ValidatePhoneNumbers(const ListValue* args) { 518 void AutofillOptionsHandler::ValidatePhoneNumbers(const ListValue* args) {
517 if (!personal_data_->IsDataLoaded()) 519 if (!personal_data_->IsDataLoaded())
518 return; 520 return;
519 521
520 ListValue* list_value = NULL; 522 ListValue* list_value = NULL;
521 ValidatePhoneArguments(args, &list_value); 523 ValidatePhoneArguments(args, &list_value);
522 524
523 web_ui_->CallJavascriptFunction( 525 web_ui_->CallJavascriptFunction(
524 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); 526 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value);
525 } 527 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/bidi_checker_web_ui_test.cc ('k') | chrome/browser/webdata/web_data_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698