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

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

Issue 8262011: Use rewritten url of a tab to find the zoom level from zoom map. Zoom map is (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 double TabContents::GetZoomLevel() const { 813 double TabContents::GetZoomLevel() const {
814 HostZoomMap* zoom_map = browser_context()->GetHostZoomMap(); 814 HostZoomMap* zoom_map = browser_context()->GetHostZoomMap();
815 if (!zoom_map) 815 if (!zoom_map)
816 return 0; 816 return 0;
817 817
818 double zoom_level; 818 double zoom_level;
819 if (temporary_zoom_settings_) { 819 if (temporary_zoom_settings_) {
820 zoom_level = zoom_map->GetTemporaryZoomLevel( 820 zoom_level = zoom_map->GetTemporaryZoomLevel(
821 GetRenderProcessHost()->id(), render_view_host()->routing_id()); 821 GetRenderProcessHost()->id(), render_view_host()->routing_id());
822 } else { 822 } else {
823 zoom_level = zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL(GetURL())); 823 GURL url;
824 NavigationEntry* active_entry = controller().GetActiveEntry();
825 // Since zoom map is updated using rewritten URL, use rewritten URL
826 // to get the zoom level.
827 url = active_entry ? active_entry->url() : GURL::EmptyGURL();
828 zoom_level = zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL(url));
824 } 829 }
825 return zoom_level; 830 return zoom_level;
826 } 831 }
827 832
828 int TabContents::GetZoomPercent(bool* enable_increment, 833 int TabContents::GetZoomPercent(bool* enable_increment,
829 bool* enable_decrement) { 834 bool* enable_decrement) {
830 *enable_decrement = *enable_increment = false; 835 *enable_decrement = *enable_increment = false;
831 int percent = static_cast<int>( 836 int percent = static_cast<int>(
832 WebKit::WebView::zoomLevelToZoomFactor(GetZoomLevel()) * 100); 837 WebKit::WebView::zoomLevelToZoomFactor(GetZoomLevel()) * 100);
833 *enable_decrement = percent > minimum_zoom_percent_; 838 *enable_decrement = percent > minimum_zoom_percent_;
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 1976
1972 void TabContents::set_encoding(const std::string& encoding) { 1977 void TabContents::set_encoding(const std::string& encoding) {
1973 encoding_ = content::GetContentClient()->browser()-> 1978 encoding_ = content::GetContentClient()->browser()->
1974 GetCanonicalEncodingNameByAliasName(encoding); 1979 GetCanonicalEncodingNameByAliasName(encoding);
1975 } 1980 }
1976 1981
1977 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 1982 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
1978 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 1983 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
1979 rwh_view->SetSize(view()->GetContainerSize()); 1984 rwh_view->SetSize(view()->GetContainerSize());
1980 } 1985 }
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698