DescriptionA number of changes to content/ needed to facilitate the new zoom extension API, which is outlined in: https://docs.google.com/a/chromium.org/document/d/1sCZjx1J3_M2a02T8NXd-ufGKZDoBHI5Ixis1DaGLQCA/edit?usp=sharing.
The changes are:
1. Each WebContents now has a zoom mode. This zoom mode affects the zoom behavior when WebContents::SetZoomMode is called.
REASON: The zoom API needs the ability to override default zoom behavior. One big use case of this API is for the new PDF viewer extension, which needs to be able to override chrome's default zooming and rescale PDF pages in a custom way. Also, a big feature of the zoom extension API is to allow extensions to control the scale of zoom changes, e.g. to be able to override the default per-origin zooming in favor of a temporary zoom that is limited to a single tab. These zoom modes provide a way to specify what kind of zoom behavior each WebContents should have.
2. WebContents::SetZoomLevel now has an optional callback function that can be provided.
REASON: This API needs to be able to tell when a zoom change has actually finished (i.e. the page has actually finished rescaling and so on), and so this callback nicely provides that functionality. Moreover, I believe that this functionality is very useful in general; other entities that call SetZoomLevel may also want to know when the zooming has completed, or take some specific action when it has completed.
3. Every zoom change initiated from WebContents::SetZoomLevel is given a unique zoom ID. This allows each zoom change to be uniquely identified. This zoom ID is carried along the path from WebContents to HostZoomMap so, where the callback associated with that zoom change will be called.
REASON: When an extension uses the zoom API to zoom a page, ZoomController associates that zoom change's zoom ID with the extension that initiated the zoom. Then, when HostZoomMap notifies the ZoomController that a zoom change has been completed, ZoomController will know exactly which extension, if any, caused that zoom, so that when the zoom bubble appears, the correct extension's icon can be added to the zoom bubble to attribute the zoom to the extension.
4. Two new notifications are created that are both sent out from WebContents. One is sent out from when a zoom change is initiated, and contains all of the details of that zoom change. The other is sent out when a WebContents returns to the default zoom mode.
REASON: The zoom API includes a new |onZoomChange| event that contains all of the details of the zoom change, including which tab zoomed, and the zoom factor before and after the zoom changed. The first notification sends out this information so that the TabsEventRouter can use it to dispatch the |onZoomChange| event. The second notification is picked up be the HostZoomMap simply to tell it that it no longer needs to maintain a special zoom level for the WebContents that send it.
BUG=30583
Patch Set 1 #
Total comments: 10
Patch Set 2 : Now zoom IDs never leave content; SetZoomLevel now has an optional callback. #Patch Set 3 : Addressed Comments. #
Total comments: 10
Patch Set 4 : No longer using notifications. #Patch Set 5 : Addressed comments. #
Total comments: 12
Patch Set 6 : Addressed comments. #
Total comments: 10
Messages
Total messages: 12 (0 generated)
|