We report on a numerical study of the shear flow of a simple two-dimensional model of a granular material under controlled normal stress between two parallel smooth frictional walls moving with opposite velocities ±V. Discrete simulations, which are carried out with the contact dynamics method in dense assemblies of disks, reveal that, unlike rough walls made of strands of particles, smooth ones can lead to shear strain localization in the boundary layer. Specifically, we observe, for decreasing V, first a fluidlike regime (A), in which the whole granular layer is sheared, with a homogeneous strain rate except near the walls, then (B) a symmetric velocity profile with a solid block in the middle and strain localized near the walls, and finally (C) a state with broken symmetry in which the shear rate is confined to one boundary layer, while the bulk of the material moves together with the opposite wall. Both transitions are independent of system size and occur for specific values of V. Transient times are discussed. We show that the first transition, between regimes A and B, can be deduced from constitutive laws identified for the bulk material and the boundary layer, while the second one could be associated with an instability in the behavior of the boundary layer. The boundary zone constitutive law, however, is observed to depend on the state of the bulk material nearby.