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 "chrome/browser/ui/toolbar/app_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/app_menu_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // instead of enabling/disabling the top-level menu item, the submenu's | 164 // instead of enabling/disabling the top-level menu item, the submenu's |
165 // contents get disabled, per Apple's HIG. | 165 // contents get disabled, per Apple's HIG. |
166 #if defined(OS_MACOSX) | 166 #if defined(OS_MACOSX) |
167 enabled &= chrome::IsCommandEnabled(browser_, IDC_ENCODING_MENU); | 167 enabled &= chrome::IsCommandEnabled(browser_, IDC_ENCODING_MENU); |
168 #endif | 168 #endif |
169 return enabled; | 169 return enabled; |
170 } | 170 } |
171 | 171 |
172 bool EncodingMenuModel::GetAcceleratorForCommandId( | 172 bool EncodingMenuModel::GetAcceleratorForCommandId( |
173 int command_id, | 173 int command_id, |
174 ui::Accelerator* accelerator) { | 174 ui::Accelerator* accelerator) const { |
175 return false; | 175 return false; |
176 } | 176 } |
177 | 177 |
178 void EncodingMenuModel::ExecuteCommand(int command_id, int event_flags) { | 178 void EncodingMenuModel::ExecuteCommand(int command_id, int event_flags) { |
179 chrome::ExecuteCommand(browser_, command_id); | 179 chrome::ExecuteCommand(browser_, command_id); |
180 } | 180 } |
181 | 181 |
182 //////////////////////////////////////////////////////////////////////////////// | 182 //////////////////////////////////////////////////////////////////////////////// |
183 // ZoomMenuModel | 183 // ZoomMenuModel |
184 | 184 |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 case IDC_BOOKMARK_PAGE: | 714 case IDC_BOOKMARK_PAGE: |
715 return !chrome::ShouldRemoveBookmarkThisPageUI(browser_->profile()); | 715 return !chrome::ShouldRemoveBookmarkThisPageUI(browser_->profile()); |
716 case IDC_BOOKMARK_ALL_TABS: | 716 case IDC_BOOKMARK_ALL_TABS: |
717 return !chrome::ShouldRemoveBookmarkOpenPagesUI(browser_->profile()); | 717 return !chrome::ShouldRemoveBookmarkOpenPagesUI(browser_->profile()); |
718 #endif | 718 #endif |
719 default: | 719 default: |
720 return true; | 720 return true; |
721 } | 721 } |
722 } | 722 } |
723 | 723 |
724 bool AppMenuModel::GetAcceleratorForCommandId(int command_id, | 724 bool AppMenuModel::GetAcceleratorForCommandId( |
725 ui::Accelerator* accelerator) { | 725 int command_id, |
| 726 ui::Accelerator* accelerator) const { |
726 return provider_->GetAcceleratorForCommandId(command_id, accelerator); | 727 return provider_->GetAcceleratorForCommandId(command_id, accelerator); |
727 } | 728 } |
728 | 729 |
729 void AppMenuModel::ActiveTabChanged(WebContents* old_contents, | 730 void AppMenuModel::ActiveTabChanged(WebContents* old_contents, |
730 WebContents* new_contents, | 731 WebContents* new_contents, |
731 int index, | 732 int index, |
732 int reason) { | 733 int reason) { |
733 // The user has switched between tabs and the new tab may have a different | 734 // The user has switched between tabs and the new tab may have a different |
734 // zoom setting. | 735 // zoom setting. |
735 UpdateZoomControls(); | 736 UpdateZoomControls(); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 browser_->tab_strip_model()->GetActiveWebContents()) | 940 browser_->tab_strip_model()->GetActiveWebContents()) |
940 ->GetZoomPercent(); | 941 ->GetZoomPercent(); |
941 } | 942 } |
942 zoom_label_ = base::FormatPercent(zoom_percent); | 943 zoom_label_ = base::FormatPercent(zoom_percent); |
943 } | 944 } |
944 | 945 |
945 void AppMenuModel::OnZoomLevelChanged( | 946 void AppMenuModel::OnZoomLevelChanged( |
946 const content::HostZoomMap::ZoomLevelChange& change) { | 947 const content::HostZoomMap::ZoomLevelChange& change) { |
947 UpdateZoomControls(); | 948 UpdateZoomControls(); |
948 } | 949 } |
OLD | NEW |