Implement the EncodingMenuController class functionality in C++ to pass the provided test cases. The implementation should fulfill the following specific requirements:
Encoding Menu Command:
Implement the method DoesCommandBelongToEncodingMenu(int command_id), which checks if the given command ID belongs to a predefined set of valid encoding command IDs. It should return false for command IDs that are invalid (like 0 and -1).
Valid Encoding IDs:
Implement the method NumValidGUIEncodingIDs() that returns the number of valid encoding IDs.
Implement the method ValidGUIEncodingIDs() that returns a pointer to an array of valid encoding command IDs, which includes at least IDC_ENCODING_AUTO_DETECT and other valid encoding IDs.
Get Encoding Menu Items:
Implement the method GetEncodingMenuItems(TestingProfile* profile, EncodingMenuItemList* items) which populates the items list with encoding menu items. The first item should always be IDC_ENCODING_AUTO_DETECT.
Check if Item is Checked:
Implement the method IsItemChecked(TestingProfile* profile, const std::string& encoding, int command_id). This method should check the state of certain encoding options based on the profile's preferences, especially checking if autodetect is enabled or if a specific encoding ID is enabled (only one encoding should be selectable when autodetection is off).
Profile Preferences:
Be familiar with the preference key prefs::kWebKitUsesUniversalDetector used to track whether autodetect is enabled.
Place your implementation for the EncodingMenuController class in the /app/ directory. Make sure each of the methods described above strictly adheres to the requirements to ensure that all tests pass successfully.