Chromium Code Reviews| 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 "content/browser/host_zoom_map_impl.h" | 5 #include "content/browser/host_zoom_map_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 | 234 |
| 235 void HostZoomMapImpl::SetZoomLevelForWebContents( | 235 void HostZoomMapImpl::SetZoomLevelForWebContents( |
| 236 const WebContentsImpl& web_contents_impl, | 236 const WebContentsImpl& web_contents_impl, |
| 237 double level) { | 237 double level) { |
| 238 int render_process_id = web_contents_impl.GetRenderProcessHost()->GetID(); | 238 int render_process_id = web_contents_impl.GetRenderProcessHost()->GetID(); |
| 239 int render_view_id = web_contents_impl.GetRenderViewHost()->GetRoutingID(); | 239 int render_view_id = web_contents_impl.GetRenderViewHost()->GetRoutingID(); |
| 240 if (UsesTemporaryZoomLevel(render_process_id, render_view_id)) { | 240 if (UsesTemporaryZoomLevel(render_process_id, render_view_id)) { |
| 241 | 241 |
| 242 SetTemporaryZoomLevel(render_process_id, render_view_id, level); | 242 SetTemporaryZoomLevel(render_process_id, render_view_id, level); |
| 243 } else { | 243 } else { |
| 244 SetZoomLevelForHost( | 244 GURL url = |
| 245 net::GetHostOrSpecFromURL(web_contents_impl.GetLastCommittedURL()), | 245 web_contents_impl.GetController().GetLastCommittedEntry()->GetURL(); |
|
Peter Kasting
2014/06/02 20:38:53
(1) Are we guaranteed to have a committed entry by
| |
| 246 level); | 246 SetZoomLevelForHost(net::GetHostOrSpecFromURL(url), level); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 void HostZoomMapImpl::SetZoomLevelForView(int render_process_id, | 250 void HostZoomMapImpl::SetZoomLevelForView(int render_process_id, |
| 251 int render_view_id, | 251 int render_view_id, |
| 252 double level, | 252 double level, |
| 253 const std::string& host) { | 253 const std::string& host) { |
| 254 if (UsesTemporaryZoomLevel(render_process_id, render_view_id)) | 254 if (UsesTemporaryZoomLevel(render_process_id, render_view_id)) |
| 255 SetTemporaryZoomLevel(render_process_id, render_view_id, level); | 255 SetTemporaryZoomLevel(render_process_id, render_view_id, level); |
| 256 else | 256 else |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 zoom_level(0.0) { | 375 zoom_level(0.0) { |
| 376 } | 376 } |
| 377 | 377 |
| 378 bool HostZoomMapImpl::TemporaryZoomLevel::operator==( | 378 bool HostZoomMapImpl::TemporaryZoomLevel::operator==( |
| 379 const TemporaryZoomLevel& other) const { | 379 const TemporaryZoomLevel& other) const { |
| 380 return other.render_process_id == render_process_id && | 380 return other.render_process_id == render_process_id && |
| 381 other.render_view_id == render_view_id; | 381 other.render_view_id == render_view_id; |
| 382 } | 382 } |
| 383 | 383 |
| 384 } // namespace content | 384 } // namespace content |
| OLD | NEW |