| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/wrench_menu_model.h" | 5 #include "chrome/browser/wrench_menu_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| 11 #include "app/menus/button_menu_item_model.h" | 11 #include "app/menus/button_menu_item_model.h" |
| 12 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
| 13 #include "base/command_line.h" |
| 13 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 14 #include "chrome/app/chrome_dll_resource.h" | 15 #include "chrome/app/chrome_dll_resource.h" |
| 15 #include "chrome/browser/browser.h" | 16 #include "chrome/browser/browser.h" |
| 16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/defaults.h" | 18 #include "chrome/browser/defaults.h" |
| 18 #include "chrome/browser/encoding_menu_controller.h" | 19 #include "chrome/browser/encoding_menu_controller.h" |
| 19 #include "chrome/browser/host_zoom_map.h" | 20 #include "chrome/browser/host_zoom_map.h" |
| 20 #include "chrome/browser/profile.h" | 21 #include "chrome/browser/profile.h" |
| 21 #include "chrome/browser/sync/profile_sync_service.h" | 22 #include "chrome/browser/sync/profile_sync_service.h" |
| 22 #include "chrome/browser/sync/sync_ui_util.h" | 23 #include "chrome/browser/sync/sync_ui_util.h" |
| 23 #include "chrome/browser/tab_contents/tab_contents.h" | 24 #include "chrome/browser/tab_contents/tab_contents.h" |
| 24 #include "chrome/browser/upgrade_detector.h" | 25 #include "chrome/browser/upgrade_detector.h" |
| 26 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/notification_service.h" | 27 #include "chrome/common/notification_service.h" |
| 26 #include "chrome/common/notification_source.h" | 28 #include "chrome/common/notification_source.h" |
| 27 #include "chrome/common/notification_type.h" | 29 #include "chrome/common/notification_type.h" |
| 28 #include "grit/chromium_strings.h" | 30 #include "grit/chromium_strings.h" |
| 29 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
| 30 #include "grit/theme_resources.h" | 32 #include "grit/theme_resources.h" |
| 31 | 33 |
| 32 //////////////////////////////////////////////////////////////////////////////// | 34 //////////////////////////////////////////////////////////////////////////////// |
| 33 // EncodingMenuModel | 35 // EncodingMenuModel |
| 34 | 36 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 AddSeparator(); | 293 AddSeparator(); |
| 292 AddItemWithStringId(IDC_SAVE_PAGE, IDS_SAVE_PAGE); | 294 AddItemWithStringId(IDC_SAVE_PAGE, IDS_SAVE_PAGE); |
| 293 AddItemWithStringId(IDC_FIND, IDS_FIND); | 295 AddItemWithStringId(IDC_FIND, IDS_FIND); |
| 294 AddItemWithStringId(IDC_PRINT, IDS_PRINT); | 296 AddItemWithStringId(IDC_PRINT, IDS_PRINT); |
| 295 | 297 |
| 296 tools_menu_model_.reset(new ToolsMenuModel(delegate(), browser_)); | 298 tools_menu_model_.reset(new ToolsMenuModel(delegate(), browser_)); |
| 297 AddSubMenuWithStringId(IDC_ZOOM_MENU, IDS_TOOLS_MENU, | 299 AddSubMenuWithStringId(IDC_ZOOM_MENU, IDS_TOOLS_MENU, |
| 298 tools_menu_model_.get()); | 300 tools_menu_model_.get()); |
| 299 | 301 |
| 300 AddSeparator(); | 302 AddSeparator(); |
| 303 #if defined(ENABLE_REMOTING) |
| 304 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableRemoting)) { |
| 305 AddItem(IDC_REMOTING_SETUP, |
| 306 l10n_util::GetStringUTF16(IDS_REMOTING_SETUP_LABEL)); |
| 307 } |
| 308 #endif |
| 301 AddItemWithStringId(IDC_SHOW_BOOKMARK_MANAGER, IDS_BOOKMARK_MANAGER); | 309 AddItemWithStringId(IDC_SHOW_BOOKMARK_MANAGER, IDS_BOOKMARK_MANAGER); |
| 302 AddItemWithStringId(IDC_SHOW_HISTORY, IDS_SHOW_HISTORY); | 310 AddItemWithStringId(IDC_SHOW_HISTORY, IDS_SHOW_HISTORY); |
| 303 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); | 311 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); |
| 304 AddSeparator(); | 312 AddSeparator(); |
| 305 | 313 |
| 306 #if defined(OS_MACOSX) | 314 #if defined(OS_MACOSX) |
| 307 AddItemWithStringId(IDC_OPTIONS, IDS_PREFERENCES_MAC); | 315 AddItemWithStringId(IDC_OPTIONS, IDS_PREFERENCES_MAC); |
| 308 #else | 316 #else |
| 309 AddItemWithStringId(IDC_OPTIONS, IDS_OPTIONS); | 317 AddItemWithStringId(IDC_OPTIONS, IDS_OPTIONS); |
| 310 #endif | 318 #endif |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 int command_id = GetCommandIdAt(index); | 404 int command_id = GetCommandIdAt(index); |
| 397 return command_id == IDC_SYNC_BOOKMARKS || | 405 return command_id == IDC_SYNC_BOOKMARKS || |
| 398 command_id == IDC_ABOUT; | 406 command_id == IDC_ABOUT; |
| 399 } | 407 } |
| 400 | 408 |
| 401 bool WrenchMenuModel::IsCommandIdEnabled(int command_id) const { | 409 bool WrenchMenuModel::IsCommandIdEnabled(int command_id) const { |
| 402 if (delegate_) | 410 if (delegate_) |
| 403 return delegate_->IsCommandIdEnabled(command_id); | 411 return delegate_->IsCommandIdEnabled(command_id); |
| 404 return true; | 412 return true; |
| 405 } | 413 } |
| OLD | NEW |