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