| OLD | NEW | 
|---|
| 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/automation/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" | 
| 6 | 6 | 
| 7 #include <set> | 7 #include <set> | 
| 8 | 8 | 
| 9 #include "app/message_box_flags.h" | 9 #include "app/message_box_flags.h" | 
| 10 #include "base/callback.h" | 10 #include "base/callback.h" | 
| (...skipping 2537 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2548   string16 password_element; | 2548   string16 password_element; | 
| 2549   string16 submit_element; | 2549   string16 submit_element; | 
| 2550   string16 action_target_text; | 2550   string16 action_target_text; | 
| 2551   bool blacklist = false; | 2551   bool blacklist = false; | 
| 2552   string16 old_password_element; | 2552   string16 old_password_element; | 
| 2553   string16 old_password_value; | 2553   string16 old_password_value; | 
| 2554 | 2554 | 
| 2555   // We don't care if any of these fail - they are either optional or checked | 2555   // We don't care if any of these fail - they are either optional or checked | 
| 2556   // before this function is called. | 2556   // before this function is called. | 
| 2557   password_dict.GetString("signon_realm", &signon_realm); | 2557   password_dict.GetString("signon_realm", &signon_realm); | 
| 2558   password_dict.GetStringAsUTF16("username_value", &username_value); | 2558   password_dict.GetString("username_value", &username_value); | 
| 2559   password_dict.GetStringAsUTF16("password_value", &password_value); | 2559   password_dict.GetString("password_value", &password_value); | 
| 2560   password_dict.GetStringAsUTF16("origin_url", &origin_url_text); | 2560   password_dict.GetString("origin_url", &origin_url_text); | 
| 2561   password_dict.GetStringAsUTF16("username_element", &username_element); | 2561   password_dict.GetString("username_element", &username_element); | 
| 2562   password_dict.GetStringAsUTF16("password_element", &password_element); | 2562   password_dict.GetString("password_element", &password_element); | 
| 2563   password_dict.GetStringAsUTF16("submit_element", &submit_element); | 2563   password_dict.GetString("submit_element", &submit_element); | 
| 2564   password_dict.GetStringAsUTF16("action_target", &action_target_text); | 2564   password_dict.GetString("action_target", &action_target_text); | 
| 2565   password_dict.GetBoolean("blacklist", &blacklist); | 2565   password_dict.GetBoolean("blacklist", &blacklist); | 
| 2566 | 2566 | 
| 2567   GURL origin_gurl(origin_url_text); | 2567   GURL origin_gurl(origin_url_text); | 
| 2568   GURL action_target(action_target_text); | 2568   GURL action_target(action_target_text); | 
| 2569 | 2569 | 
| 2570   webkit_glue::PasswordForm password_form; | 2570   webkit_glue::PasswordForm password_form; | 
| 2571   password_form.signon_realm = signon_realm; | 2571   password_form.signon_realm = signon_realm; | 
| 2572   password_form.username_value = username_value; | 2572   password_form.username_value = username_value; | 
| 2573   password_form.password_value = password_value; | 2573   password_form.password_value = password_value; | 
| 2574   password_form.origin = origin_gurl; | 2574   password_form.origin = origin_gurl; | 
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3123   for (int i = 0; i < num_profiles; i++) { | 3123   for (int i = 0; i < num_profiles; i++) { | 
| 3124     profiles.GetDictionary(i, &profile_info); | 3124     profiles.GetDictionary(i, &profile_info); | 
| 3125     profile_info->GetString("label", &profile_label); | 3125     profile_info->GetString("label", &profile_label); | 
| 3126     // Choose an id of 0 so that a unique id will be created. | 3126     // Choose an id of 0 so that a unique id will be created. | 
| 3127     AutoFillProfile profile(profile_label, 0); | 3127     AutoFillProfile profile(profile_label, 0); | 
| 3128     // Loop through the possible profile types and add those provided. | 3128     // Loop through the possible profile types and add those provided. | 
| 3129     for (std::map<AutoFillFieldType, std::wstring>::iterator type_it = | 3129     for (std::map<AutoFillFieldType, std::wstring>::iterator type_it = | 
| 3130          autofill_type_to_string.begin(); | 3130          autofill_type_to_string.begin(); | 
| 3131          type_it != autofill_type_to_string.end(); ++type_it) { | 3131          type_it != autofill_type_to_string.end(); ++type_it) { | 
| 3132       if (profile_info->HasKey(type_it->second)) { | 3132       if (profile_info->HasKey(type_it->second)) { | 
| 3133         if (profile_info->GetStringAsUTF16(type_it->second, ¤t_value)) { | 3133         if (profile_info->GetString(WideToUTF8(type_it->second), | 
|  | 3134                                     ¤t_value)) { | 
| 3134           profile.SetInfo(AutoFillType(type_it->first), current_value); | 3135           profile.SetInfo(AutoFillType(type_it->first), current_value); | 
| 3135         } else { | 3136         } else { | 
| 3136           *error_message= "All values must be strings"; | 3137           *error_message= "All values must be strings"; | 
| 3137           break; | 3138           break; | 
| 3138         } | 3139         } | 
| 3139       } | 3140       } | 
| 3140     } | 3141     } | 
| 3141     autofill_profiles.push_back(profile); | 3142     autofill_profiles.push_back(profile); | 
| 3142   } | 3143   } | 
| 3143   return autofill_profiles; | 3144   return autofill_profiles; | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 3157   int num_credit_cards = cards.GetSize(); | 3158   int num_credit_cards = cards.GetSize(); | 
| 3158   for (int i = 0; i < num_credit_cards; i++) { | 3159   for (int i = 0; i < num_credit_cards; i++) { | 
| 3159     cards.GetDictionary(i, &card_info); | 3160     cards.GetDictionary(i, &card_info); | 
| 3160     card_info->GetString("label", &card_label); | 3161     card_info->GetString("label", &card_label); | 
| 3161     CreditCard card(card_label, 0); | 3162     CreditCard card(card_label, 0); | 
| 3162     // Loop through the possible credit card fields and add those provided. | 3163     // Loop through the possible credit card fields and add those provided. | 
| 3163     for (std::map<AutoFillFieldType, std::wstring>::iterator type_it = | 3164     for (std::map<AutoFillFieldType, std::wstring>::iterator type_it = | 
| 3164         credit_card_type_to_string.begin(); | 3165         credit_card_type_to_string.begin(); | 
| 3165         type_it != credit_card_type_to_string.end(); ++type_it) { | 3166         type_it != credit_card_type_to_string.end(); ++type_it) { | 
| 3166       if (card_info->HasKey(type_it->second)) { | 3167       if (card_info->HasKey(type_it->second)) { | 
| 3167         if (card_info->GetStringAsUTF16(type_it->second, ¤t_value)) { | 3168         if (card_info->GetString(WideToUTF8(type_it->second), ¤t_value)) { | 
| 3168           card.SetInfo(AutoFillType(type_it->first), current_value); | 3169           card.SetInfo(AutoFillType(type_it->first), current_value); | 
| 3169         } else { | 3170         } else { | 
| 3170           *error_message= "All values must be strings"; | 3171           *error_message= "All values must be strings"; | 
| 3171           break; | 3172           break; | 
| 3172         } | 3173         } | 
| 3173       } | 3174       } | 
| 3174     } | 3175     } | 
| 3175     credit_cards.push_back(card); | 3176     credit_cards.push_back(card); | 
| 3176   } | 3177   } | 
| 3177   return credit_cards; | 3178   return credit_cards; | 
| (...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4480 } | 4481 } | 
| 4481 | 4482 | 
| 4482 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { | 4483 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { | 
| 4483   NOTIMPLEMENTED(); | 4484   NOTIMPLEMENTED(); | 
| 4484 } | 4485 } | 
| 4485 #endif  // !defined(TOOLKIT_VIEWS) | 4486 #endif  // !defined(TOOLKIT_VIEWS) | 
| 4486 | 4487 | 
| 4487 void AutomationProvider::ResetToDefaultTheme() { | 4488 void AutomationProvider::ResetToDefaultTheme() { | 
| 4488   profile_->ClearTheme(); | 4489   profile_->ClearTheme(); | 
| 4489 } | 4490 } | 
| OLD | NEW | 
|---|