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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 base::AutoLock auto_lock(lock_); | 433 base::AutoLock auto_lock(lock_); |
434 view_page_scale_factors_are_one_.erase( | 434 view_page_scale_factors_are_one_.erase( |
435 RenderViewKey(render_process_id, render_view_id)); | 435 RenderViewKey(render_process_id, render_view_id)); |
436 } | 436 } |
437 | 437 |
438 bool HostZoomMapImpl::UsesTemporaryZoomLevel(int render_process_id, | 438 bool HostZoomMapImpl::UsesTemporaryZoomLevel(int render_process_id, |
439 int render_view_id) const { | 439 int render_view_id) const { |
440 RenderViewKey key(render_process_id, render_view_id); | 440 RenderViewKey key(render_process_id, render_view_id); |
441 | 441 |
442 base::AutoLock auto_lock(lock_); | 442 base::AutoLock auto_lock(lock_); |
443 return ContainsKey(temporary_zoom_levels_, key); | 443 return base::ContainsKey(temporary_zoom_levels_, key); |
444 } | 444 } |
445 | 445 |
446 double HostZoomMapImpl::GetTemporaryZoomLevel(int render_process_id, | 446 double HostZoomMapImpl::GetTemporaryZoomLevel(int render_process_id, |
447 int render_view_id) const { | 447 int render_view_id) const { |
448 base::AutoLock auto_lock(lock_); | 448 base::AutoLock auto_lock(lock_); |
449 RenderViewKey key(render_process_id, render_view_id); | 449 RenderViewKey key(render_process_id, render_view_id); |
450 if (!ContainsKey(temporary_zoom_levels_, key)) | 450 if (!base::ContainsKey(temporary_zoom_levels_, key)) |
451 return 0; | 451 return 0; |
452 | 452 |
453 return temporary_zoom_levels_.find(key)->second; | 453 return temporary_zoom_levels_.find(key)->second; |
454 } | 454 } |
455 | 455 |
456 void HostZoomMapImpl::SetTemporaryZoomLevel(int render_process_id, | 456 void HostZoomMapImpl::SetTemporaryZoomLevel(int render_process_id, |
457 int render_view_id, | 457 int render_view_id, |
458 double level) { | 458 double level) { |
459 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 459 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
460 | 460 |
(...skipping 15 matching lines...) Expand all Loading... |
476 | 476 |
477 zoom_level_changed_callbacks_.Notify(change); | 477 zoom_level_changed_callbacks_.Notify(change); |
478 } | 478 } |
479 | 479 |
480 double HostZoomMapImpl::GetZoomLevelForView(const GURL& url, | 480 double HostZoomMapImpl::GetZoomLevelForView(const GURL& url, |
481 int render_process_id, | 481 int render_process_id, |
482 int render_view_id) const { | 482 int render_view_id) const { |
483 RenderViewKey key(render_process_id, render_view_id); | 483 RenderViewKey key(render_process_id, render_view_id); |
484 base::AutoLock auto_lock(lock_); | 484 base::AutoLock auto_lock(lock_); |
485 | 485 |
486 if (ContainsKey(temporary_zoom_levels_, key)) | 486 if (base::ContainsKey(temporary_zoom_levels_, key)) |
487 return temporary_zoom_levels_.find(key)->second; | 487 return temporary_zoom_levels_.find(key)->second; |
488 | 488 |
489 return GetZoomLevelForHostAndSchemeInternal(url.scheme(), | 489 return GetZoomLevelForHostAndSchemeInternal(url.scheme(), |
490 net::GetHostOrSpecFromURL(url)); | 490 net::GetHostOrSpecFromURL(url)); |
491 } | 491 } |
492 | 492 |
493 void HostZoomMapImpl::Observe(int type, | 493 void HostZoomMapImpl::Observe(int type, |
494 const NotificationSource& source, | 494 const NotificationSource& source, |
495 const NotificationDetails& details) { | 495 const NotificationDetails& details) { |
496 switch (type) { | 496 switch (type) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |