| OLD | NEW |
| 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/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 if (browser_tracker_->ContainsHandle(handle)) { | 1012 if (browser_tracker_->ContainsHandle(handle)) { |
| 1013 Browser* browser = browser_tracker_->GetResource(handle); | 1013 Browser* browser = browser_tracker_->GetResource(handle); |
| 1014 if (browser) | 1014 if (browser) |
| 1015 *visible = browser->window()->IsFullscreenBubbleVisible(); | 1015 *visible = browser->window()->IsFullscreenBubbleVisible(); |
| 1016 } | 1016 } |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 void TestingAutomationProvider::GetAutocompleteEditText( | 1019 void TestingAutomationProvider::GetAutocompleteEditText( |
| 1020 int autocomplete_edit_handle, | 1020 int autocomplete_edit_handle, |
| 1021 bool* success, | 1021 bool* success, |
| 1022 std::wstring* text) { | 1022 string16* text) { |
| 1023 *success = false; | 1023 *success = false; |
| 1024 if (autocomplete_edit_tracker_->ContainsHandle(autocomplete_edit_handle)) { | 1024 if (autocomplete_edit_tracker_->ContainsHandle(autocomplete_edit_handle)) { |
| 1025 *text = autocomplete_edit_tracker_->GetResource(autocomplete_edit_handle)-> | 1025 *text = autocomplete_edit_tracker_->GetResource(autocomplete_edit_handle)-> |
| 1026 GetText(); | 1026 GetText(); |
| 1027 *success = true; | 1027 *success = true; |
| 1028 } | 1028 } |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 void TestingAutomationProvider::SetAutocompleteEditText( | 1031 void TestingAutomationProvider::SetAutocompleteEditText( |
| 1032 int autocomplete_edit_handle, | 1032 int autocomplete_edit_handle, |
| 1033 const std::wstring& text, | 1033 const string16& text, |
| 1034 bool* success) { | 1034 bool* success) { |
| 1035 *success = false; | 1035 *success = false; |
| 1036 if (autocomplete_edit_tracker_->ContainsHandle(autocomplete_edit_handle)) { | 1036 if (autocomplete_edit_tracker_->ContainsHandle(autocomplete_edit_handle)) { |
| 1037 autocomplete_edit_tracker_->GetResource(autocomplete_edit_handle)-> | 1037 autocomplete_edit_tracker_->GetResource(autocomplete_edit_handle)-> |
| 1038 SetUserText(text); | 1038 SetUserText(text); |
| 1039 *success = true; | 1039 *success = true; |
| 1040 } | 1040 } |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 void TestingAutomationProvider::AutocompleteEditGetMatches( | 1043 void TestingAutomationProvider::AutocompleteEditGetMatches( |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 if (!tab_contents) { | 1118 if (!tab_contents) { |
| 1119 AutomationMsg_DomOperation::WriteReplyParams(reply_message, std::string()); | 1119 AutomationMsg_DomOperation::WriteReplyParams(reply_message, std::string()); |
| 1120 Send(reply_message); | 1120 Send(reply_message); |
| 1121 return; | 1121 return; |
| 1122 } | 1122 } |
| 1123 | 1123 |
| 1124 // Set the routing id of this message with the controller. | 1124 // Set the routing id of this message with the controller. |
| 1125 // This routing id needs to be remembered for the reverse | 1125 // This routing id needs to be remembered for the reverse |
| 1126 // communication while sending back the response of | 1126 // communication while sending back the response of |
| 1127 // this javascript execution. | 1127 // this javascript execution. |
| 1128 std::wstring set_automation_id; | 1128 std::string set_automation_id; |
| 1129 base::SStringPrintf(&set_automation_id, | 1129 base::SStringPrintf(&set_automation_id, |
| 1130 L"window.domAutomationController.setAutomationId(%d);", | 1130 "window.domAutomationController.setAutomationId(%d);", |
| 1131 reply_message->routing_id()); | 1131 reply_message->routing_id()); |
| 1132 | 1132 |
| 1133 DCHECK(reply_message_ == NULL); | 1133 DCHECK(reply_message_ == NULL); |
| 1134 reply_message_ = reply_message; | 1134 reply_message_ = reply_message; |
| 1135 | 1135 |
| 1136 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( | 1136 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( |
| 1137 frame_xpath, set_automation_id); | 1137 frame_xpath, UTF8ToWide(set_automation_id)); |
| 1138 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( | 1138 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( |
| 1139 frame_xpath, script); | 1139 frame_xpath, script); |
| 1140 } | 1140 } |
| 1141 | 1141 |
| 1142 void TestingAutomationProvider::GetConstrainedWindowCount(int handle, | 1142 void TestingAutomationProvider::GetConstrainedWindowCount(int handle, |
| 1143 int* count) { | 1143 int* count) { |
| 1144 *count = -1; // -1 is the error code | 1144 *count = -1; // -1 is the error code |
| 1145 if (tab_tracker_->ContainsHandle(handle)) { | 1145 if (tab_tracker_->ContainsHandle(handle)) { |
| 1146 NavigationController* nav_controller = tab_tracker_->GetResource(handle); | 1146 NavigationController* nav_controller = tab_tracker_->GetResource(handle); |
| 1147 TabContents* tab_contents = nav_controller->tab_contents(); | 1147 TabContents* tab_contents = nav_controller->tab_contents(); |
| (...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2845 // Fill up matches. | 2845 // Fill up matches. |
| 2846 ListValue* matches = new ListValue; | 2846 ListValue* matches = new ListValue; |
| 2847 const AutocompleteResult& result = model->result(); | 2847 const AutocompleteResult& result = model->result(); |
| 2848 for (AutocompleteResult::const_iterator i = result.begin(); | 2848 for (AutocompleteResult::const_iterator i = result.begin(); |
| 2849 i != result.end(); ++i) { | 2849 i != result.end(); ++i) { |
| 2850 const AutocompleteMatch& match = *i; | 2850 const AutocompleteMatch& match = *i; |
| 2851 DictionaryValue* item = new DictionaryValue; // owned by return_value | 2851 DictionaryValue* item = new DictionaryValue; // owned by return_value |
| 2852 item->SetString("type", AutocompleteMatch::TypeToString(match.type)); | 2852 item->SetString("type", AutocompleteMatch::TypeToString(match.type)); |
| 2853 item->SetBoolean("starred", match.starred); | 2853 item->SetBoolean("starred", match.starred); |
| 2854 item->SetString("destination_url", match.destination_url.spec()); | 2854 item->SetString("destination_url", match.destination_url.spec()); |
| 2855 item->SetString("contents", WideToUTF16Hack(match.contents)); | 2855 item->SetString("contents", match.contents); |
| 2856 item->SetString("description", WideToUTF16Hack(match.description)); | 2856 item->SetString("description", match.description); |
| 2857 matches->Append(item); | 2857 matches->Append(item); |
| 2858 } | 2858 } |
| 2859 return_value->Set("matches", matches); | 2859 return_value->Set("matches", matches); |
| 2860 | 2860 |
| 2861 // Fill up other properties. | 2861 // Fill up other properties. |
| 2862 DictionaryValue* properties = new DictionaryValue; // owned by return_value | 2862 DictionaryValue* properties = new DictionaryValue; // owned by return_value |
| 2863 properties->SetBoolean("has_focus", model->has_focus()); | 2863 properties->SetBoolean("has_focus", model->has_focus()); |
| 2864 properties->SetBoolean("query_in_progress", model->query_in_progress()); | 2864 properties->SetBoolean("query_in_progress", model->query_in_progress()); |
| 2865 properties->SetString("keyword", WideToUTF16Hack(model->keyword())); | 2865 properties->SetString("keyword", model->keyword()); |
| 2866 properties->SetString("text", WideToUTF16Hack(edit_view->GetText())); | 2866 properties->SetString("text", edit_view->GetText()); |
| 2867 return_value->Set("properties", properties); | 2867 return_value->Set("properties", properties); |
| 2868 | 2868 |
| 2869 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); | 2869 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
| 2870 } | 2870 } |
| 2871 | 2871 |
| 2872 // Sample json input: { "command": "SetOmniboxText", | 2872 // Sample json input: { "command": "SetOmniboxText", |
| 2873 // "text": "goog" } | 2873 // "text": "goog" } |
| 2874 void TestingAutomationProvider::SetOmniboxText(Browser* browser, | 2874 void TestingAutomationProvider::SetOmniboxText(Browser* browser, |
| 2875 DictionaryValue* args, | 2875 DictionaryValue* args, |
| 2876 IPC::Message* reply_message) { | 2876 IPC::Message* reply_message) { |
| 2877 string16 text; | 2877 string16 text; |
| 2878 AutomationJSONReply reply(this, reply_message); | 2878 AutomationJSONReply reply(this, reply_message); |
| 2879 if (!args->GetString("text", &text)) { | 2879 if (!args->GetString("text", &text)) { |
| 2880 reply.SendError("text missing"); | 2880 reply.SendError("text missing"); |
| 2881 return; | 2881 return; |
| 2882 } | 2882 } |
| 2883 browser->FocusLocationBar(); | 2883 browser->FocusLocationBar(); |
| 2884 LocationBar* loc_bar = browser->window()->GetLocationBar(); | 2884 LocationBar* loc_bar = browser->window()->GetLocationBar(); |
| 2885 AutocompleteEditView* edit_view = loc_bar->location_entry(); | 2885 AutocompleteEditView* edit_view = loc_bar->location_entry(); |
| 2886 edit_view->model()->OnSetFocus(false); | 2886 edit_view->model()->OnSetFocus(false); |
| 2887 edit_view->SetUserText(UTF16ToWideHack(text)); | 2887 edit_view->SetUserText(text); |
| 2888 reply.SendSuccess(NULL); | 2888 reply.SendSuccess(NULL); |
| 2889 } | 2889 } |
| 2890 | 2890 |
| 2891 // Sample json input: { "command": "OmniboxMovePopupSelection", | 2891 // Sample json input: { "command": "OmniboxMovePopupSelection", |
| 2892 // "count": 1 } | 2892 // "count": 1 } |
| 2893 // Negative count implies up, positive implies down. Count values will be | 2893 // Negative count implies up, positive implies down. Count values will be |
| 2894 // capped by the size of the popup list. | 2894 // capped by the size of the popup list. |
| 2895 void TestingAutomationProvider::OmniboxMovePopupSelection( | 2895 void TestingAutomationProvider::OmniboxMovePopupSelection( |
| 2896 Browser* browser, | 2896 Browser* browser, |
| 2897 DictionaryValue* args, | 2897 DictionaryValue* args, |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4038 reply.SendError("Disabling sync for given datatypes was unsuccessful"); | 4038 reply.SendError("Disabling sync for given datatypes was unsuccessful"); |
| 4039 } | 4039 } |
| 4040 } | 4040 } |
| 4041 } | 4041 } |
| 4042 | 4042 |
| 4043 /* static */ | 4043 /* static */ |
| 4044 ListValue* TestingAutomationProvider::GetListFromAutoFillProfiles( | 4044 ListValue* TestingAutomationProvider::GetListFromAutoFillProfiles( |
| 4045 const std::vector<AutoFillProfile*>& autofill_profiles) { | 4045 const std::vector<AutoFillProfile*>& autofill_profiles) { |
| 4046 ListValue* profiles = new ListValue; | 4046 ListValue* profiles = new ListValue; |
| 4047 | 4047 |
| 4048 std::map<AutoFillFieldType, std::wstring> autofill_type_to_string | 4048 std::map<AutoFillFieldType, std::string> autofill_type_to_string |
| 4049 = GetAutoFillFieldToStringMap(); | 4049 = GetAutoFillFieldToStringMap(); |
| 4050 | 4050 |
| 4051 // For each AutoFillProfile, transform it to a dictionary object to return. | 4051 // For each AutoFillProfile, transform it to a dictionary object to return. |
| 4052 for (std::vector<AutoFillProfile*>::const_iterator it = | 4052 for (std::vector<AutoFillProfile*>::const_iterator it = |
| 4053 autofill_profiles.begin(); | 4053 autofill_profiles.begin(); |
| 4054 it != autofill_profiles.end(); ++it) { | 4054 it != autofill_profiles.end(); ++it) { |
| 4055 AutoFillProfile* profile = *it; | 4055 AutoFillProfile* profile = *it; |
| 4056 DictionaryValue* profile_info = new DictionaryValue; | 4056 DictionaryValue* profile_info = new DictionaryValue; |
| 4057 // For each of the types, if it has a value, add it to the dictionary. | 4057 // For each of the types, if it has a value, add it to the dictionary. |
| 4058 for (std::map<AutoFillFieldType, std::wstring>::iterator | 4058 for (std::map<AutoFillFieldType, std::string>::iterator |
| 4059 type_it = autofill_type_to_string.begin(); | 4059 type_it = autofill_type_to_string.begin(); |
| 4060 type_it != autofill_type_to_string.end(); ++type_it) { | 4060 type_it != autofill_type_to_string.end(); ++type_it) { |
| 4061 string16 value = profile->GetFieldText(AutoFillType(type_it->first)); | 4061 string16 value = profile->GetFieldText(AutoFillType(type_it->first)); |
| 4062 if (value.length()) { // If there was something stored for that value. | 4062 if (value.length()) { // If there was something stored for that value. |
| 4063 profile_info->SetString(WideToUTF8(type_it->second), value); | 4063 profile_info->SetString(type_it->second, value); |
| 4064 } | 4064 } |
| 4065 } | 4065 } |
| 4066 profiles->Append(profile_info); | 4066 profiles->Append(profile_info); |
| 4067 } | 4067 } |
| 4068 return profiles; | 4068 return profiles; |
| 4069 } | 4069 } |
| 4070 | 4070 |
| 4071 /* static */ | 4071 /* static */ |
| 4072 ListValue* TestingAutomationProvider::GetListFromCreditCards( | 4072 ListValue* TestingAutomationProvider::GetListFromCreditCards( |
| 4073 const std::vector<CreditCard*>& credit_cards) { | 4073 const std::vector<CreditCard*>& credit_cards) { |
| 4074 ListValue* cards = new ListValue; | 4074 ListValue* cards = new ListValue; |
| 4075 | 4075 |
| 4076 std::map<AutoFillFieldType, std::wstring> credit_card_type_to_string = | 4076 std::map<AutoFillFieldType, std::string> credit_card_type_to_string = |
| 4077 GetCreditCardFieldToStringMap(); | 4077 GetCreditCardFieldToStringMap(); |
| 4078 | 4078 |
| 4079 // For each AutoFillProfile, transform it to a dictionary object to return. | 4079 // For each AutoFillProfile, transform it to a dictionary object to return. |
| 4080 for (std::vector<CreditCard*>::const_iterator it = | 4080 for (std::vector<CreditCard*>::const_iterator it = |
| 4081 credit_cards.begin(); | 4081 credit_cards.begin(); |
| 4082 it != credit_cards.end(); ++it) { | 4082 it != credit_cards.end(); ++it) { |
| 4083 CreditCard* card = *it; | 4083 CreditCard* card = *it; |
| 4084 DictionaryValue* card_info = new DictionaryValue; | 4084 DictionaryValue* card_info = new DictionaryValue; |
| 4085 // For each of the types, if it has a value, add it to the dictionary. | 4085 // For each of the types, if it has a value, add it to the dictionary. |
| 4086 for (std::map<AutoFillFieldType, std::wstring>::iterator type_it = | 4086 for (std::map<AutoFillFieldType, std::string>::iterator type_it = |
| 4087 credit_card_type_to_string.begin(); | 4087 credit_card_type_to_string.begin(); |
| 4088 type_it != credit_card_type_to_string.end(); ++type_it) { | 4088 type_it != credit_card_type_to_string.end(); ++type_it) { |
| 4089 string16 value = card->GetFieldText(AutoFillType(type_it->first)); | 4089 string16 value = card->GetFieldText(AutoFillType(type_it->first)); |
| 4090 // If there was something stored for that value. | 4090 // If there was something stored for that value. |
| 4091 if (value.length()) { | 4091 if (value.length()) { |
| 4092 card_info->SetString(WideToUTF8(type_it->second), value); | 4092 card_info->SetString(type_it->second, value); |
| 4093 } | 4093 } |
| 4094 } | 4094 } |
| 4095 cards->Append(card_info); | 4095 cards->Append(card_info); |
| 4096 } | 4096 } |
| 4097 return cards; | 4097 return cards; |
| 4098 } | 4098 } |
| 4099 | 4099 |
| 4100 /* static */ | 4100 /* static */ |
| 4101 std::vector<AutoFillProfile> | 4101 std::vector<AutoFillProfile> |
| 4102 TestingAutomationProvider::GetAutoFillProfilesFromList( | 4102 TestingAutomationProvider::GetAutoFillProfilesFromList( |
| 4103 const ListValue& profiles, std::string* error_message) { | 4103 const ListValue& profiles, std::string* error_message) { |
| 4104 std::vector<AutoFillProfile> autofill_profiles; | 4104 std::vector<AutoFillProfile> autofill_profiles; |
| 4105 DictionaryValue* profile_info = NULL; | 4105 DictionaryValue* profile_info = NULL; |
| 4106 string16 current_value; | 4106 string16 current_value; |
| 4107 | 4107 |
| 4108 std::map<AutoFillFieldType, std::wstring> autofill_type_to_string = | 4108 std::map<AutoFillFieldType, std::string> autofill_type_to_string = |
| 4109 GetAutoFillFieldToStringMap(); | 4109 GetAutoFillFieldToStringMap(); |
| 4110 | 4110 |
| 4111 int num_profiles = profiles.GetSize(); | 4111 int num_profiles = profiles.GetSize(); |
| 4112 for (int i = 0; i < num_profiles; i++) { | 4112 for (int i = 0; i < num_profiles; i++) { |
| 4113 profiles.GetDictionary(i, &profile_info); | 4113 profiles.GetDictionary(i, &profile_info); |
| 4114 AutoFillProfile profile; | 4114 AutoFillProfile profile; |
| 4115 // Loop through the possible profile types and add those provided. | 4115 // Loop through the possible profile types and add those provided. |
| 4116 for (std::map<AutoFillFieldType, std::wstring>::iterator type_it = | 4116 for (std::map<AutoFillFieldType, std::string>::iterator type_it = |
| 4117 autofill_type_to_string.begin(); | 4117 autofill_type_to_string.begin(); |
| 4118 type_it != autofill_type_to_string.end(); ++type_it) { | 4118 type_it != autofill_type_to_string.end(); ++type_it) { |
| 4119 if (profile_info->HasKey(WideToUTF8(type_it->second))) { | 4119 if (profile_info->HasKey(type_it->second)) { |
| 4120 if (profile_info->GetString(WideToUTF8(type_it->second), | 4120 if (profile_info->GetString(type_it->second, |
| 4121 ¤t_value)) { | 4121 ¤t_value)) { |
| 4122 profile.SetInfo(AutoFillType(type_it->first), current_value); | 4122 profile.SetInfo(AutoFillType(type_it->first), current_value); |
| 4123 } else { | 4123 } else { |
| 4124 *error_message= "All values must be strings"; | 4124 *error_message= "All values must be strings"; |
| 4125 break; | 4125 break; |
| 4126 } | 4126 } |
| 4127 } | 4127 } |
| 4128 } | 4128 } |
| 4129 autofill_profiles.push_back(profile); | 4129 autofill_profiles.push_back(profile); |
| 4130 } | 4130 } |
| 4131 return autofill_profiles; | 4131 return autofill_profiles; |
| 4132 } | 4132 } |
| 4133 | 4133 |
| 4134 /* static */ | 4134 /* static */ |
| 4135 std::vector<CreditCard> TestingAutomationProvider::GetCreditCardsFromList( | 4135 std::vector<CreditCard> TestingAutomationProvider::GetCreditCardsFromList( |
| 4136 const ListValue& cards, std::string* error_message) { | 4136 const ListValue& cards, std::string* error_message) { |
| 4137 std::vector<CreditCard> credit_cards; | 4137 std::vector<CreditCard> credit_cards; |
| 4138 DictionaryValue* card_info = NULL; | 4138 DictionaryValue* card_info = NULL; |
| 4139 string16 current_value; | 4139 string16 current_value; |
| 4140 | 4140 |
| 4141 std::map<AutoFillFieldType, std::wstring> credit_card_type_to_string = | 4141 std::map<AutoFillFieldType, std::string> credit_card_type_to_string = |
| 4142 GetCreditCardFieldToStringMap(); | 4142 GetCreditCardFieldToStringMap(); |
| 4143 | 4143 |
| 4144 int num_credit_cards = cards.GetSize(); | 4144 int num_credit_cards = cards.GetSize(); |
| 4145 for (int i = 0; i < num_credit_cards; i++) { | 4145 for (int i = 0; i < num_credit_cards; i++) { |
| 4146 cards.GetDictionary(i, &card_info); | 4146 cards.GetDictionary(i, &card_info); |
| 4147 CreditCard card; | 4147 CreditCard card; |
| 4148 // Loop through the possible credit card fields and add those provided. | 4148 // Loop through the possible credit card fields and add those provided. |
| 4149 for (std::map<AutoFillFieldType, std::wstring>::iterator type_it = | 4149 for (std::map<AutoFillFieldType, std::string>::iterator type_it = |
| 4150 credit_card_type_to_string.begin(); | 4150 credit_card_type_to_string.begin(); |
| 4151 type_it != credit_card_type_to_string.end(); ++type_it) { | 4151 type_it != credit_card_type_to_string.end(); ++type_it) { |
| 4152 if (card_info->HasKey(WideToUTF8(type_it->second))) { | 4152 if (card_info->HasKey(type_it->second)) { |
| 4153 if (card_info->GetString(WideToUTF8(type_it->second), ¤t_value)) { | 4153 if (card_info->GetString(type_it->second, ¤t_value)) { |
| 4154 card.SetInfo(AutoFillType(type_it->first), current_value); | 4154 card.SetInfo(AutoFillType(type_it->first), current_value); |
| 4155 } else { | 4155 } else { |
| 4156 *error_message= "All values must be strings"; | 4156 *error_message= "All values must be strings"; |
| 4157 break; | 4157 break; |
| 4158 } | 4158 } |
| 4159 } | 4159 } |
| 4160 } | 4160 } |
| 4161 credit_cards.push_back(card); | 4161 credit_cards.push_back(card); |
| 4162 } | 4162 } |
| 4163 return credit_cards; | 4163 return credit_cards; |
| 4164 } | 4164 } |
| 4165 | 4165 |
| 4166 /* static */ | 4166 /* static */ |
| 4167 std::map<AutoFillFieldType, std::wstring> | 4167 std::map<AutoFillFieldType, std::string> |
| 4168 TestingAutomationProvider::GetAutoFillFieldToStringMap() { | 4168 TestingAutomationProvider::GetAutoFillFieldToStringMap() { |
| 4169 std::map<AutoFillFieldType, std::wstring> autofill_type_to_string; | 4169 std::map<AutoFillFieldType, std::string> autofill_type_to_string; |
| 4170 autofill_type_to_string[NAME_FIRST] = L"NAME_FIRST"; | 4170 autofill_type_to_string[NAME_FIRST] = "NAME_FIRST"; |
| 4171 autofill_type_to_string[NAME_MIDDLE] = L"NAME_MIDDLE"; | 4171 autofill_type_to_string[NAME_MIDDLE] = "NAME_MIDDLE"; |
| 4172 autofill_type_to_string[NAME_LAST] = L"NAME_LAST"; | 4172 autofill_type_to_string[NAME_LAST] = "NAME_LAST"; |
| 4173 autofill_type_to_string[COMPANY_NAME] = L"COMPANY_NAME"; | 4173 autofill_type_to_string[COMPANY_NAME] = "COMPANY_NAME"; |
| 4174 autofill_type_to_string[EMAIL_ADDRESS] = L"EMAIL_ADDRESS"; | 4174 autofill_type_to_string[EMAIL_ADDRESS] = "EMAIL_ADDRESS"; |
| 4175 autofill_type_to_string[ADDRESS_HOME_LINE1] = L"ADDRESS_HOME_LINE1"; | 4175 autofill_type_to_string[ADDRESS_HOME_LINE1] = "ADDRESS_HOME_LINE1"; |
| 4176 autofill_type_to_string[ADDRESS_HOME_LINE2] = L"ADDRESS_HOME_LINE2"; | 4176 autofill_type_to_string[ADDRESS_HOME_LINE2] = "ADDRESS_HOME_LINE2"; |
| 4177 autofill_type_to_string[ADDRESS_HOME_CITY] = L"ADDRESS_HOME_CITY"; | 4177 autofill_type_to_string[ADDRESS_HOME_CITY] = "ADDRESS_HOME_CITY"; |
| 4178 autofill_type_to_string[ADDRESS_HOME_STATE] = L"ADDRESS_HOME_STATE"; | 4178 autofill_type_to_string[ADDRESS_HOME_STATE] = "ADDRESS_HOME_STATE"; |
| 4179 autofill_type_to_string[ADDRESS_HOME_ZIP] = L"ADDRESS_HOME_ZIP"; | 4179 autofill_type_to_string[ADDRESS_HOME_ZIP] = "ADDRESS_HOME_ZIP"; |
| 4180 autofill_type_to_string[ADDRESS_HOME_COUNTRY] = L"ADDRESS_HOME_COUNTRY"; | 4180 autofill_type_to_string[ADDRESS_HOME_COUNTRY] = "ADDRESS_HOME_COUNTRY"; |
| 4181 autofill_type_to_string[PHONE_HOME_WHOLE_NUMBER] = | 4181 autofill_type_to_string[PHONE_HOME_WHOLE_NUMBER] = |
| 4182 L"PHONE_HOME_WHOLE_NUMBER"; | 4182 "PHONE_HOME_WHOLE_NUMBER"; |
| 4183 autofill_type_to_string[PHONE_FAX_WHOLE_NUMBER] = L"PHONE_FAX_WHOLE_NUMBER"; | 4183 autofill_type_to_string[PHONE_FAX_WHOLE_NUMBER] = "PHONE_FAX_WHOLE_NUMBER"; |
| 4184 autofill_type_to_string[NAME_FIRST] = L"NAME_FIRST"; | 4184 autofill_type_to_string[NAME_FIRST] = "NAME_FIRST"; |
| 4185 return autofill_type_to_string; | 4185 return autofill_type_to_string; |
| 4186 } | 4186 } |
| 4187 | 4187 |
| 4188 /* static */ | 4188 /* static */ |
| 4189 std::map<AutoFillFieldType, std::wstring> | 4189 std::map<AutoFillFieldType, std::string> |
| 4190 TestingAutomationProvider::GetCreditCardFieldToStringMap() { | 4190 TestingAutomationProvider::GetCreditCardFieldToStringMap() { |
| 4191 std::map<AutoFillFieldType, std::wstring> credit_card_type_to_string; | 4191 std::map<AutoFillFieldType, std::string> credit_card_type_to_string; |
| 4192 credit_card_type_to_string[CREDIT_CARD_NAME] = L"CREDIT_CARD_NAME"; | 4192 credit_card_type_to_string[CREDIT_CARD_NAME] = "CREDIT_CARD_NAME"; |
| 4193 credit_card_type_to_string[CREDIT_CARD_NUMBER] = L"CREDIT_CARD_NUMBER"; | 4193 credit_card_type_to_string[CREDIT_CARD_NUMBER] = "CREDIT_CARD_NUMBER"; |
| 4194 credit_card_type_to_string[CREDIT_CARD_EXP_MONTH] = L"CREDIT_CARD_EXP_MONTH"; | 4194 credit_card_type_to_string[CREDIT_CARD_EXP_MONTH] = "CREDIT_CARD_EXP_MONTH"; |
| 4195 credit_card_type_to_string[CREDIT_CARD_EXP_4_DIGIT_YEAR] = | 4195 credit_card_type_to_string[CREDIT_CARD_EXP_4_DIGIT_YEAR] = |
| 4196 L"CREDIT_CARD_EXP_4_DIGIT_YEAR"; | 4196 "CREDIT_CARD_EXP_4_DIGIT_YEAR"; |
| 4197 return credit_card_type_to_string; | 4197 return credit_card_type_to_string; |
| 4198 } | 4198 } |
| 4199 | 4199 |
| 4200 // Refer to GetActiveNotifications() in chrome/test/pyautolib/pyauto.py for | 4200 // Refer to GetActiveNotifications() in chrome/test/pyautolib/pyauto.py for |
| 4201 // sample json input/output. | 4201 // sample json input/output. |
| 4202 void TestingAutomationProvider::GetActiveNotifications( | 4202 void TestingAutomationProvider::GetActiveNotifications( |
| 4203 Browser* browser, | 4203 Browser* browser, |
| 4204 DictionaryValue* args, | 4204 DictionaryValue* args, |
| 4205 IPC::Message* reply_message) { | 4205 IPC::Message* reply_message) { |
| 4206 new GetActiveNotificationsObserver(this, reply_message); | 4206 new GetActiveNotificationsObserver(this, reply_message); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4514 // If you change this, update Observer for NotificationType::SESSION_END | 4514 // If you change this, update Observer for NotificationType::SESSION_END |
| 4515 // below. | 4515 // below. |
| 4516 MessageLoop::current()->PostTask(FROM_HERE, | 4516 MessageLoop::current()->PostTask(FROM_HERE, |
| 4517 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); | 4517 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); |
| 4518 } | 4518 } |
| 4519 } | 4519 } |
| 4520 | 4520 |
| 4521 void TestingAutomationProvider::OnRemoveProvider() { | 4521 void TestingAutomationProvider::OnRemoveProvider() { |
| 4522 AutomationProviderList::GetInstance()->RemoveProvider(this); | 4522 AutomationProviderList::GetInstance()->RemoveProvider(this); |
| 4523 } | 4523 } |
| OLD | NEW |