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

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

Issue 10736037: Enable keyboard shortcuts and some menu commands for browserless Panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
OLDNEW
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 "chrome/browser/ui/browser_commands.h" 5 #include "chrome/browser/ui/browser_commands.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/bookmarks/bookmark_editor.h" 10 #include "chrome/browser/bookmarks/bookmark_editor.h"
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 find_tab_helper()->StartFinding(find_text, 696 find_tab_helper()->StartFinding(find_text,
697 forward_direction, 697 forward_direction,
698 false); // Not case sensitive. 698 false); // Not case sensitive.
699 } 699 }
700 } 700 }
701 701
702 void Zoom(Browser* browser, content::PageZoom zoom) { 702 void Zoom(Browser* browser, content::PageZoom zoom) {
703 if (browser->is_devtools()) 703 if (browser->is_devtools())
704 return; 704 return;
705 705
706 content::RenderViewHost* host = 706 Zoom(GetActiveWebContents(browser), browser->profile(), zoom);
707 GetActiveWebContents(browser)->GetRenderViewHost(); 707 }
708
709 void Zoom(content::WebContents* web_contents, Profile* profile,
710 content::PageZoom zoom) {
711 content::RenderViewHost* host = web_contents->GetRenderViewHost();
Ben Goodger (Google) 2012/07/11 22:28:26 I think you may need this in a different file sinc
708 if (zoom == content::PAGE_ZOOM_RESET) { 712 if (zoom == content::PAGE_ZOOM_RESET) {
709 host->SetZoomLevel(0); 713 host->SetZoomLevel(0);
710 content::RecordAction(UserMetricsAction("ZoomNormal")); 714 content::RecordAction(UserMetricsAction("ZoomNormal"));
711 return; 715 return;
712 } 716 }
713 717
714 double current_zoom_level = GetActiveWebContents(browser)->GetZoomLevel(); 718 double current_zoom_level = web_contents->GetZoomLevel();
715 double default_zoom_level = 719 double default_zoom_level =
716 browser->profile()->GetPrefs()->GetDouble(prefs::kDefaultZoomLevel); 720 profile->GetPrefs()->GetDouble(prefs::kDefaultZoomLevel);
717 721
718 // Generate a vector of zoom levels from an array of known presets along with 722 // Generate a vector of zoom levels from an array of known presets along with
719 // the default level added if necessary. 723 // the default level added if necessary.
720 std::vector<double> zoom_levels = 724 std::vector<double> zoom_levels =
721 chrome_page_zoom::PresetZoomLevels(default_zoom_level); 725 chrome_page_zoom::PresetZoomLevels(default_zoom_level);
722 726
723 if (zoom == content::PAGE_ZOOM_OUT) { 727 if (zoom == content::PAGE_ZOOM_OUT) {
724 // Iterate through the zoom levels in reverse order to find the next 728 // Iterate through the zoom levels in reverse order to find the next
725 // lower level based on the current zoom level for this page. 729 // lower level based on the current zoom level for this page.
726 for (std::vector<double>::reverse_iterator i = zoom_levels.rbegin(); 730 for (std::vector<double>::reverse_iterator i = zoom_levels.rbegin();
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 if (!tab_contents) 959 if (!tab_contents)
956 tab_contents = new TabContents(contents); 960 tab_contents = new TabContents(contents);
957 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); 961 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true);
958 962
959 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 963 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
960 contents->GetRenderViewHost()->SyncRendererPrefs(); 964 contents->GetRenderViewHost()->SyncRendererPrefs();
961 app_browser->window()->Show(); 965 app_browser->window()->Show();
962 } 966 }
963 967
964 } // namespace chrome 968 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698