[show abstract][hide abstract] ABSTRACT: We introduce a systematic formalism for two-resonator circuit QED, where two on-chip microwave resonators are simultaneously coupled to one superconducting qubit. Within this framework, we demonstrate that the qubit can function as a quantum switch between the two resonators, which are assumed to be originally independent. In this three-circuit network, the qubit mediates a geometric second-order circuit interaction between the otherwise decoupled resonators. In the dispersive regime, it also gives rise to a dynamic second-order perturbative interaction. The geometric and dynamic coupling strengths can be tuned to be equal, thus permitting to switch on and off the interaction between the two resonators via a qubit population inversion or a shifting of the qubit operation point. We also show that our quantum switch represents a flexible architecture for the manipulation and generation of nonclassical microwave field states as well as the creation of controlled multipartite entanglement in circuit QED. In addition, we clarify the role played by the geometric interaction, which constitutes a fundamental property characteristic of superconducting quantum circuits without a counterpart in quantum-optical systems. We develop a detailed theory of the geometric second-order coupling by means of circuit transformations for superconducting charge and flux qubits. Furthermore, we show the robustness of the quantum switch operation with respect to decoherence mechanisms. Finally, we propose a realistic design for a two-resonator circuit QED setup based on a flux qubit and estimate all the related parameters. In this manner, we show that this setup can be used to implement a superconducting quantum switch with available technology.