| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 HostZoomMap* HostZoomMap::Get(SiteInstance* instance) { | 70 HostZoomMap* HostZoomMap::Get(SiteInstance* instance) { |
| 71 StoragePartition* partition = BrowserContext::GetStoragePartition( | 71 StoragePartition* partition = BrowserContext::GetStoragePartition( |
| 72 instance->GetBrowserContext(), instance); | 72 instance->GetBrowserContext(), instance); |
| 73 DCHECK(partition); | 73 DCHECK(partition); |
| 74 return partition->GetHostZoomMap(); | 74 return partition->GetHostZoomMap(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 HostZoomMap* HostZoomMap::GetForWebContents(const WebContents* contents) { | 77 HostZoomMap* HostZoomMap::GetForWebContents(const WebContents* contents) { |
| 78 // TODO(wjmaclean): Update this behaviour to work with OOPIF. |
| 79 // See crbug.com/528407. |
| 78 StoragePartition* partition = | 80 StoragePartition* partition = |
| 79 BrowserContext::GetStoragePartition(contents->GetBrowserContext(), | 81 BrowserContext::GetStoragePartition(contents->GetBrowserContext(), |
| 80 contents->GetSiteInstance()); | 82 contents->GetSiteInstance()); |
| 81 DCHECK(partition); | 83 DCHECK(partition); |
| 82 return partition->GetHostZoomMap(); | 84 return partition->GetHostZoomMap(); |
| 83 } | 85 } |
| 84 | 86 |
| 85 // Helper function for setting/getting zoom levels for WebContents without | 87 // Helper function for setting/getting zoom levels for WebContents without |
| 86 // having to import HostZoomMapImpl everywhere. | 88 // having to import HostZoomMapImpl everywhere. |
| 87 double HostZoomMap::GetZoomLevel(const WebContents* web_contents) { | 89 double HostZoomMap::GetZoomLevel(const WebContents* web_contents) { |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 double error_page_zoom_level = GetZoomLevelForHost(host); | 490 double error_page_zoom_level = GetZoomLevelForHost(host); |
| 489 | 491 |
| 490 SendZoomLevelChange(std::string(), host, error_page_zoom_level); | 492 SendZoomLevelChange(std::string(), host, error_page_zoom_level); |
| 491 } | 493 } |
| 492 | 494 |
| 493 HostZoomMapImpl::~HostZoomMapImpl() { | 495 HostZoomMapImpl::~HostZoomMapImpl() { |
| 494 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 496 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 495 } | 497 } |
| 496 | 498 |
| 497 } // namespace content | 499 } // namespace content |
| OLD | NEW |