OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/ui/zoom/zoom_controller.h" | 5 #include "components/ui/zoom/zoom_controller.h" |
6 | 6 |
7 #include "components/ui/zoom/zoom_event_manager.h" | 7 #include "components/ui/zoom/zoom_event_manager.h" |
8 #include "components/ui/zoom/zoom_observer.h" | 8 #include "components/ui/zoom/zoom_observer.h" |
9 #include "content/public/browser/host_zoom_map.h" | 9 #include "content/public/browser/host_zoom_map.h" |
10 #include "content/public/browser/navigation_details.h" | 10 #include "content/public/browser/navigation_details.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 false /* can_show_bubble */)); | 128 false /* can_show_bubble */)); |
129 int render_process_id = web_contents()->GetRenderProcessHost()->GetID(); | 129 int render_process_id = web_contents()->GetRenderProcessHost()->GetID(); |
130 int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID(); | 130 int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID(); |
131 if (zoom_mode_ == ZOOM_MODE_ISOLATED || | 131 if (zoom_mode_ == ZOOM_MODE_ISOLATED || |
132 zoom_map->UsesTemporaryZoomLevel(render_process_id, render_view_id)) { | 132 zoom_map->UsesTemporaryZoomLevel(render_process_id, render_view_id)) { |
133 zoom_map->SetTemporaryZoomLevel(render_process_id, render_view_id, | 133 zoom_map->SetTemporaryZoomLevel(render_process_id, render_view_id, |
134 zoom_level); | 134 zoom_level); |
135 } else { | 135 } else { |
136 if (!entry) { | 136 if (!entry) { |
137 last_client_ = NULL; | 137 last_client_ = NULL; |
| 138 // If we exit without triggering an update, we should clear event_data_, |
| 139 // else we may later trigger a DCHECK(event_data_). |
| 140 event_data_.reset(); |
138 return false; | 141 return false; |
139 } | 142 } |
140 std::string host = | 143 std::string host = |
141 net::GetHostOrSpecFromURL(content::HostZoomMap::GetURLFromEntry(entry)); | 144 net::GetHostOrSpecFromURL(content::HostZoomMap::GetURLFromEntry(entry)); |
142 zoom_map->SetZoomLevelForHost(host, zoom_level); | 145 zoom_map->SetZoomLevelForHost(host, zoom_level); |
143 } | 146 } |
144 | 147 |
145 DCHECK(!event_data_); | 148 DCHECK(!event_data_); |
146 last_client_ = NULL; | 149 last_client_ = NULL; |
147 return true; | 150 return true; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID(); | 349 int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID(); |
347 host_zoom_map_->SetPageScaleFactorIsOneForView( | 350 host_zoom_map_->SetPageScaleFactorIsOneForView( |
348 render_process_id, render_view_id, is_one); | 351 render_process_id, render_view_id, is_one); |
349 } | 352 } |
350 | 353 |
351 bool ZoomController::PageScaleFactorIsOne() const { | 354 bool ZoomController::PageScaleFactorIsOne() const { |
352 return content::HostZoomMap::PageScaleFactorIsOne(web_contents()); | 355 return content::HostZoomMap::PageScaleFactorIsOne(web_contents()); |
353 } | 356 } |
354 | 357 |
355 } // namespace ui_zoom | 358 } // namespace ui_zoom |
OLD | NEW |