Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: content/browser/host_zoom_map_impl.cc

Issue 2101943004: content: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase/update Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 for (auto it = host_zoom_levels_.begin(); it != host_zoom_levels_.end(); ) { 290 for (auto it = host_zoom_levels_.begin(); it != host_zoom_levels_.end(); ) {
291 if (ZoomValuesEqual(it->second, default_zoom_level_)) 291 if (ZoomValuesEqual(it->second, default_zoom_level_))
292 it = host_zoom_levels_.erase(it); 292 it = host_zoom_levels_.erase(it);
293 else 293 else
294 it++; 294 it++;
295 } 295 }
296 } 296 }
297 297
298 // Second, update zoom levels for all pages that do not have an overriding 298 // Second, update zoom levels for all pages that do not have an overriding
299 // entry. 299 // entry.
300 for (auto web_contents : WebContentsImpl::GetAllWebContents()) { 300 for (auto* web_contents : WebContentsImpl::GetAllWebContents()) {
301 // Only change zoom for WebContents tied to the StoragePartition this 301 // Only change zoom for WebContents tied to the StoragePartition this
302 // HostZoomMap serves. 302 // HostZoomMap serves.
303 if (GetForWebContents(web_contents) != this) 303 if (GetForWebContents(web_contents) != this)
304 continue; 304 continue;
305 305
306 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); 306 int render_process_id = web_contents->GetRenderProcessHost()->GetID();
307 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); 307 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID();
308 308
309 // Get the url from the navigation controller directly, as calling 309 // Get the url from the navigation controller directly, as calling
310 // WebContentsImpl::GetLastCommittedURL() may give us a virtual url that 310 // WebContentsImpl::GetLastCommittedURL() may give us a virtual url that
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 GetHostFromProcessView(render_process_id, render_view_id)), false); 524 GetHostFromProcessView(render_process_id, render_view_id)), false);
525 } 525 }
526 526
527 void HostZoomMapImpl::SendZoomLevelChange(const std::string& scheme, 527 void HostZoomMapImpl::SendZoomLevelChange(const std::string& scheme,
528 const std::string& host, 528 const std::string& host,
529 double level) { 529 double level) {
530 // We'll only send to WebContents not using temporary zoom levels. The one 530 // We'll only send to WebContents not using temporary zoom levels. The one
531 // other case of interest is where the renderer is hosting a plugin document; 531 // other case of interest is where the renderer is hosting a plugin document;
532 // that should be reflected in our temporary zoom level map, but we will 532 // that should be reflected in our temporary zoom level map, but we will
533 // double check on the renderer side to avoid the possibility of any races. 533 // double check on the renderer side to avoid the possibility of any races.
534 for (auto web_contents : WebContentsImpl::GetAllWebContents()) { 534 for (auto* web_contents : WebContentsImpl::GetAllWebContents()) {
535 // Only send zoom level changes to WebContents that are using this 535 // Only send zoom level changes to WebContents that are using this
536 // HostZoomMap. 536 // HostZoomMap.
537 if (GetForWebContents(web_contents) != this) 537 if (GetForWebContents(web_contents) != this)
538 continue; 538 continue;
539 539
540 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); 540 int render_process_id = web_contents->GetRenderProcessHost()->GetID();
541 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); 541 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID();
542 542
543 if (!UsesTemporaryZoomLevel(render_process_id, render_view_id)) 543 if (!UsesTemporaryZoomLevel(render_process_id, render_view_id))
544 web_contents->UpdateZoomIfNecessary(scheme, host, level); 544 web_contents->UpdateZoomIfNecessary(scheme, host, level);
545 } 545 }
546 } 546 }
547 547
548 void HostZoomMapImpl::SendErrorPageZoomLevelRefresh() { 548 void HostZoomMapImpl::SendErrorPageZoomLevelRefresh() {
549 GURL error_url(kUnreachableWebDataURL); 549 GURL error_url(kUnreachableWebDataURL);
550 std::string host = net::GetHostOrSpecFromURL(error_url); 550 std::string host = net::GetHostOrSpecFromURL(error_url);
551 double error_page_zoom_level = GetZoomLevelForHost(host); 551 double error_page_zoom_level = GetZoomLevelForHost(host);
552 552
553 SendZoomLevelChange(std::string(), host, error_page_zoom_level); 553 SendZoomLevelChange(std::string(), host, error_page_zoom_level);
554 } 554 }
555 555
556 HostZoomMapImpl::~HostZoomMapImpl() { 556 HostZoomMapImpl::~HostZoomMapImpl() {
557 DCHECK_CURRENTLY_ON(BrowserThread::UI); 557 DCHECK_CURRENTLY_ON(BrowserThread::UI);
558 } 558 }
559 559
560 } // namespace content 560 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/network_location_request.cc ('k') | content/browser/indexed_db/indexed_db_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698