Hong Kong, along with Macau, would exist under a specific political identity — it would become a "special administrative region" until 2047. SARs don't have to be socialist like the mainland, and they can maintain their own legal systems.
At least, that was the case until Xi became president of China.
Now Beijing is going back on that promise. In a white paper written this summer, mainland leaders said that Hong Kong's constitutional autonomy was not "an inherent power." Instead of allowing fully democratic elections, Beijing wants to select the candidates who can run in Hong Kong in 2017.