OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 double TabContents::GetZoomLevel() const { | 812 double TabContents::GetZoomLevel() const { |
813 HostZoomMap* zoom_map = browser_context()->GetHostZoomMap(); | 813 HostZoomMap* zoom_map = browser_context()->GetHostZoomMap(); |
814 if (!zoom_map) | 814 if (!zoom_map) |
815 return 0; | 815 return 0; |
816 | 816 |
817 double zoom_level; | 817 double zoom_level; |
818 if (temporary_zoom_settings_) { | 818 if (temporary_zoom_settings_) { |
819 zoom_level = zoom_map->GetTemporaryZoomLevel( | 819 zoom_level = zoom_map->GetTemporaryZoomLevel( |
820 GetRenderProcessHost()->id(), render_view_host()->routing_id()); | 820 GetRenderProcessHost()->id(), render_view_host()->routing_id()); |
821 } else { | 821 } else { |
822 zoom_level = zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL(GetURL())); | 822 GURL url; |
| 823 NavigationEntry* active_entry = controller().GetActiveEntry(); |
| 824 // Since zoom map is updated using rewritten URL, use rewritten URL |
| 825 // to get the zoom level. |
| 826 url = active_entry ? active_entry->url() : GURL::EmptyGURL(); |
| 827 zoom_level = zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL(url)); |
823 } | 828 } |
824 return zoom_level; | 829 return zoom_level; |
825 } | 830 } |
826 | 831 |
827 int TabContents::GetZoomPercent(bool* enable_increment, | 832 int TabContents::GetZoomPercent(bool* enable_increment, |
828 bool* enable_decrement) { | 833 bool* enable_decrement) { |
829 *enable_decrement = *enable_increment = false; | 834 *enable_decrement = *enable_increment = false; |
830 int percent = static_cast<int>( | 835 int percent = static_cast<int>( |
831 WebKit::WebView::zoomLevelToZoomFactor(GetZoomLevel()) * 100); | 836 WebKit::WebView::zoomLevelToZoomFactor(GetZoomLevel()) * 100); |
832 *enable_decrement = percent > minimum_zoom_percent_; | 837 *enable_decrement = percent > minimum_zoom_percent_; |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1965 | 1970 |
1966 void TabContents::set_encoding(const std::string& encoding) { | 1971 void TabContents::set_encoding(const std::string& encoding) { |
1967 encoding_ = content::GetContentClient()->browser()-> | 1972 encoding_ = content::GetContentClient()->browser()-> |
1968 GetCanonicalEncodingNameByAliasName(encoding); | 1973 GetCanonicalEncodingNameByAliasName(encoding); |
1969 } | 1974 } |
1970 | 1975 |
1971 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1976 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
1972 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1977 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
1973 rwh_view->SetSize(view()->GetContainerSize()); | 1978 rwh_view->SetSize(view()->GetContainerSize()); |
1974 } | 1979 } |
OLD | NEW |