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

Side by Side Diff: chrome/browser/browser.cc

Issue 147202: Added support for Text only zoom... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/external_tab_container.h » ('j') | 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "chrome/browser/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #include "app/animation.h" 7 #include "app/animation.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/idle_timer.h" 10 #include "base/idle_timer.h"
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 void Browser::ZoomReset() { 1028 void Browser::ZoomReset() {
1029 UserMetrics::RecordAction(L"ZoomNormal", profile_); 1029 UserMetrics::RecordAction(L"ZoomNormal", profile_);
1030 GetSelectedTabContents()->render_view_host()->Zoom(PageZoom::STANDARD); 1030 GetSelectedTabContents()->render_view_host()->Zoom(PageZoom::STANDARD);
1031 } 1031 }
1032 1032
1033 void Browser::ZoomOut() { 1033 void Browser::ZoomOut() {
1034 UserMetrics::RecordAction(L"ZoomMinus", profile_); 1034 UserMetrics::RecordAction(L"ZoomMinus", profile_);
1035 GetSelectedTabContents()->render_view_host()->Zoom(PageZoom::SMALLER); 1035 GetSelectedTabContents()->render_view_host()->Zoom(PageZoom::SMALLER);
1036 } 1036 }
1037 1037
1038 void Browser::ZoomTextOnlyIn() {
1039 UserMetrics::RecordAction(L"ZoomTextOnlyPlus", profile_);
1040 GetSelectedTabContents()->render_view_host()->Zoom(
1041 PageZoom::TEXT_ONLY_LARGER);
1042 }
1043
1044 void Browser::ZoomTextOnlyOut() {
1045 UserMetrics::RecordAction(L"ZoomTextOnlyMinus", profile_);
1046 GetSelectedTabContents()->render_view_host()->Zoom(
1047 PageZoom::TEXT_ONLY_SMALLER);
1048 }
1049
1038 void Browser::FocusToolbar() { 1050 void Browser::FocusToolbar() {
1039 UserMetrics::RecordAction(L"FocusToolbar", profile_); 1051 UserMetrics::RecordAction(L"FocusToolbar", profile_);
1040 window_->FocusToolbar(); 1052 window_->FocusToolbar();
1041 } 1053 }
1042 1054
1043 void Browser::FocusLocationBar() { 1055 void Browser::FocusLocationBar() {
1044 UserMetrics::RecordAction(L"FocusLocation", profile_); 1056 UserMetrics::RecordAction(L"FocusLocation", profile_);
1045 window_->SetFocusToLocationBar(); 1057 window_->SetFocusToLocationBar();
1046 } 1058 }
1047 1059
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 case IDC_COPY_URL: CopyCurrentPageURL(); break; 1329 case IDC_COPY_URL: CopyCurrentPageURL(); break;
1318 case IDC_PASTE: Paste(); break; 1330 case IDC_PASTE: Paste(); break;
1319 #endif 1331 #endif
1320 1332
1321 // Find-in-page 1333 // Find-in-page
1322 case IDC_FIND: Find(); break; 1334 case IDC_FIND: Find(); break;
1323 case IDC_FIND_NEXT: FindNext(); break; 1335 case IDC_FIND_NEXT: FindNext(); break;
1324 case IDC_FIND_PREVIOUS: FindPrevious(); break; 1336 case IDC_FIND_PREVIOUS: FindPrevious(); break;
1325 1337
1326 // Zoom 1338 // Zoom
1339 case IDC_ZOOM_TEXT_ONLY_PLUS: ZoomTextOnlyIn(); break;
1327 case IDC_ZOOM_PLUS: ZoomIn(); break; 1340 case IDC_ZOOM_PLUS: ZoomIn(); break;
1328 case IDC_ZOOM_NORMAL: ZoomReset(); break; 1341 case IDC_ZOOM_NORMAL: ZoomReset(); break;
1329 case IDC_ZOOM_MINUS: ZoomOut(); break; 1342 case IDC_ZOOM_MINUS: ZoomOut(); break;
1343 case IDC_ZOOM_TEXT_ONLY_MINUS: ZoomTextOnlyOut(); break;
1330 1344
1331 // Focus various bits of UI 1345 // Focus various bits of UI
1332 case IDC_FOCUS_TOOLBAR: FocusToolbar(); break; 1346 case IDC_FOCUS_TOOLBAR: FocusToolbar(); break;
1333 case IDC_FOCUS_LOCATION: FocusLocationBar(); break; 1347 case IDC_FOCUS_LOCATION: FocusLocationBar(); break;
1334 case IDC_FOCUS_SEARCH: FocusSearch(); break; 1348 case IDC_FOCUS_SEARCH: FocusSearch(); break;
1335 1349
1336 // Show various bits of UI 1350 // Show various bits of UI
1337 case IDC_OPEN_FILE: OpenFile(); break; 1351 case IDC_OPEN_FILE: OpenFile(); break;
1338 case IDC_CREATE_SHORTCUTS: OpenCreateShortcutsDialog(); break; 1352 case IDC_CREATE_SHORTCUTS: OpenCreateShortcutsDialog(); break;
1339 case IDC_JS_CONSOLE: OpenJavaScriptConsole(); break; 1353 case IDC_JS_CONSOLE: OpenJavaScriptConsole(); break;
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 if (source == GetSelectedTabContents()) { 1829 if (source == GetSelectedTabContents()) {
1816 PrefService* prefs = profile_->GetPrefs(); 1830 PrefService* prefs = profile_->GetPrefs();
1817 GetStatusBubble()->SetURL(url, prefs->GetString(prefs::kAcceptLanguages)); 1831 GetStatusBubble()->SetURL(url, prefs->GetString(prefs::kAcceptLanguages));
1818 } 1832 }
1819 } 1833 }
1820 1834
1821 void Browser::UpdateDownloadShelfVisibility(bool visible) { 1835 void Browser::UpdateDownloadShelfVisibility(bool visible) {
1822 GetStatusBubble()->UpdateDownloadShelfVisibility(visible); 1836 GetStatusBubble()->UpdateDownloadShelfVisibility(visible);
1823 } 1837 }
1824 1838
1825 void Browser::ContentsZoomChange(bool zoom_in) { 1839 void Browser::ContentsZoomChange(PageZoom::Function zoom_type) {
1826 ExecuteCommand(zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS); 1840 int zoom_requested = -1;
1841
1842 switch (zoom_type) {
1843 case PageZoom::TEXT_ONLY_SMALLER :
1844 zoom_requested = IDC_ZOOM_TEXT_ONLY_MINUS;
1845 break;
1846 case PageZoom::SMALLER :
1847 zoom_requested = IDC_ZOOM_MINUS;
1848 break;
1849 case PageZoom::LARGER :
1850 zoom_requested = IDC_ZOOM_PLUS;
1851 break;
1852 case PageZoom::TEXT_ONLY_LARGER :
1853 zoom_requested = IDC_ZOOM_TEXT_ONLY_PLUS;
1854 break;
1855 default:
1856 NOTREACHED();
1857 return;
1858 }
1859
1860 ExecuteCommand(zoom_requested);
1827 } 1861 }
1828 1862
1829 void Browser::TabContentsFocused(TabContents* tab_content) { 1863 void Browser::TabContentsFocused(TabContents* tab_content) {
1830 window_->TabContentsFocused(tab_content); 1864 window_->TabContentsFocused(tab_content);
1831 } 1865 }
1832 1866
1833 bool Browser::IsApplication() const { 1867 bool Browser::IsApplication() const {
1834 return (type_ & TYPE_APP) != 0; 1868 return (type_ & TYPE_APP) != 0;
1835 } 1869 }
1836 1870
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 // Find-in-page 2115 // Find-in-page
2082 command_updater_.UpdateCommandEnabled(IDC_FIND, true); 2116 command_updater_.UpdateCommandEnabled(IDC_FIND, true);
2083 command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT, true); 2117 command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT, true);
2084 command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, true); 2118 command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, true);
2085 2119
2086 // Zoom 2120 // Zoom
2087 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MENU, true); 2121 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MENU, true);
2088 command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, true); 2122 command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, true);
2089 command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, true); 2123 command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, true);
2090 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, true); 2124 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, true);
2125 command_updater_.UpdateCommandEnabled(IDC_ZOOM_TEXT_ONLY_PLUS, true);
2126 command_updater_.UpdateCommandEnabled(IDC_ZOOM_TEXT_ONLY_MINUS, true);
2091 2127
2092 // Show various bits of UI 2128 // Show various bits of UI
2093 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, true); 2129 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, true);
2094 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false); 2130 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false);
2095 command_updater_.UpdateCommandEnabled(IDC_JS_CONSOLE, true); 2131 command_updater_.UpdateCommandEnabled(IDC_JS_CONSOLE, true);
2096 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, true); 2132 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, true);
2097 command_updater_.UpdateCommandEnabled(IDC_SELECT_PROFILE, true); 2133 command_updater_.UpdateCommandEnabled(IDC_SELECT_PROFILE, true);
2098 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true); 2134 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true);
2099 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true); 2135 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true);
2100 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); 2136 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true);
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
2705 /////////////////////////////////////////////////////////////////////////////// 2741 ///////////////////////////////////////////////////////////////////////////////
2706 // BrowserToolbarModel (private): 2742 // BrowserToolbarModel (private):
2707 2743
2708 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { 2744 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() {
2709 // This |current_tab| can be NULL during the initialization of the 2745 // This |current_tab| can be NULL during the initialization of the
2710 // toolbar during window creation (i.e. before any tabs have been added 2746 // toolbar during window creation (i.e. before any tabs have been added
2711 // to the window). 2747 // to the window).
2712 TabContents* current_tab = browser_->GetSelectedTabContents(); 2748 TabContents* current_tab = browser_->GetSelectedTabContents();
2713 return current_tab ? &current_tab->controller() : NULL; 2749 return current_tab ? &current_tab->controller() : NULL;
2714 } 2750 }
OLDNEW
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/external_tab_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698