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

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

Issue 7554008: Removal of Profile from content part 6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 4 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/phone_number_i18n.h" 18 #include "chrome/browser/autofill/phone_number_i18n.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/webui/web_ui_util.h" 20 #include "chrome/browser/ui/webui/web_ui_util.h"
21 #include "chrome/common/guid.h" 21 #include "chrome/common/guid.h"
22 #include "content/browser/tab_contents/tab_contents.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
28 // Converts a credit card type to the appropriate resource ID of the CC icon. 29 // Converts a credit card type to the appropriate resource ID of the CC icon.
29 int CreditCardTypeToResourceID(const std::string& type) { 30 int CreditCardTypeToResourceID(const std::string& type) {
30 if (type == kAmericanExpressCard) 31 if (type == kAmericanExpressCard)
31 return IDR_AUTOFILL_CC_AMEX; 32 return IDR_AUTOFILL_CC_AMEX;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 218
218 RegisterStrings(localized_strings, resources, arraysize(resources)); 219 RegisterStrings(localized_strings, resources, arraysize(resources));
219 RegisterTitle(localized_strings, "autofillOptionsPage", 220 RegisterTitle(localized_strings, "autofillOptionsPage",
220 IDS_AUTOFILL_OPTIONS_TITLE); 221 IDS_AUTOFILL_OPTIONS_TITLE);
221 222
222 SetAddressOverlayStrings(localized_strings); 223 SetAddressOverlayStrings(localized_strings);
223 SetCreditCardOverlayStrings(localized_strings); 224 SetCreditCardOverlayStrings(localized_strings);
224 } 225 }
225 226
226 void AutofillOptionsHandler::Initialize() { 227 void AutofillOptionsHandler::Initialize() {
227 personal_data_ = web_ui_->GetProfile()->GetPersonalDataManager(); 228 Profile* profile =
229 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
230 personal_data_ = profile->GetPersonalDataManager();
228 personal_data_->SetObserver(this); 231 personal_data_->SetObserver(this);
229 232
230 LoadAutofillData(); 233 LoadAutofillData();
231 } 234 }
232 235
233 void AutofillOptionsHandler::RegisterMessages() { 236 void AutofillOptionsHandler::RegisterMessages() {
234 web_ui_->RegisterMessageCallback( 237 web_ui_->RegisterMessageCallback(
235 "removeAddress", 238 "removeAddress",
236 NewCallback(this, &AutofillOptionsHandler::RemoveAddress)); 239 NewCallback(this, &AutofillOptionsHandler::RemoveAddress));
237 web_ui_->RegisterMessageCallback( 240 web_ui_->RegisterMessageCallback(
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 void AutofillOptionsHandler::ValidateFaxNumbers(const ListValue* args) { 540 void AutofillOptionsHandler::ValidateFaxNumbers(const ListValue* args) {
538 if (!personal_data_->IsDataLoaded()) 541 if (!personal_data_->IsDataLoaded())
539 return; 542 return;
540 543
541 ListValue* list_value = NULL; 544 ListValue* list_value = NULL;
542 ValidatePhoneArguments(args, &list_value); 545 ValidatePhoneArguments(args, &list_value);
543 546
544 web_ui_->CallJavascriptFunction( 547 web_ui_->CallJavascriptFunction(
545 "AutofillEditAddressOverlay.setValidatedFaxNumbers", *list_value); 548 "AutofillEditAddressOverlay.setValidatedFaxNumbers", *list_value);
546 } 549 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698