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/browser_command_controller.h" | 5 #include "chrome/browser/ui/browser_command_controller.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 break; | 535 break; |
536 case IDC_VIEW_SOURCE: | 536 case IDC_VIEW_SOURCE: |
537 ViewSelectedSource(browser_); | 537 ViewSelectedSource(browser_); |
538 break; | 538 break; |
539 case IDC_EMAIL_PAGE_LOCATION: | 539 case IDC_EMAIL_PAGE_LOCATION: |
540 EmailPageLocation(browser_); | 540 EmailPageLocation(browser_); |
541 break; | 541 break; |
542 case IDC_PRINT: | 542 case IDC_PRINT: |
543 Print(browser_); | 543 Print(browser_); |
544 break; | 544 break; |
| 545 #if !defined(OS_WIN) |
545 case IDC_ADVANCED_PRINT: | 546 case IDC_ADVANCED_PRINT: |
546 content::RecordAction(base::UserMetricsAction("Accel_Advanced_Print")); | 547 content::RecordAction(base::UserMetricsAction("Accel_Advanced_Print")); |
547 AdvancedPrint(browser_); | 548 AdvancedPrint(browser_); |
548 break; | 549 break; |
| 550 #endif // !OS_WIN |
549 case IDC_PRINT_TO_DESTINATION: | 551 case IDC_PRINT_TO_DESTINATION: |
550 PrintToDestination(browser_); | 552 PrintToDestination(browser_); |
551 break; | 553 break; |
552 case IDC_TRANSLATE_PAGE: | 554 case IDC_TRANSLATE_PAGE: |
553 Translate(browser_); | 555 Translate(browser_); |
554 break; | 556 break; |
555 case IDC_MANAGE_PASSWORDS_FOR_PAGE: | 557 case IDC_MANAGE_PASSWORDS_FOR_PAGE: |
556 ManagePasswordsForPage(browser_); | 558 ManagePasswordsForPage(browser_); |
557 break; | 559 break; |
558 | 560 |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, fullscreen_enabled); | 1268 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, fullscreen_enabled); |
1267 command_updater_.UpdateCommandEnabled(IDC_PRESENTATION_MODE, | 1269 command_updater_.UpdateCommandEnabled(IDC_PRESENTATION_MODE, |
1268 fullscreen_enabled); | 1270 fullscreen_enabled); |
1269 | 1271 |
1270 UpdateCommandsForBookmarkBar(); | 1272 UpdateCommandsForBookmarkBar(); |
1271 } | 1273 } |
1272 | 1274 |
1273 void BrowserCommandController::UpdatePrintingState() { | 1275 void BrowserCommandController::UpdatePrintingState() { |
1274 bool print_enabled = CanPrint(browser_); | 1276 bool print_enabled = CanPrint(browser_); |
1275 command_updater_.UpdateCommandEnabled(IDC_PRINT, print_enabled); | 1277 command_updater_.UpdateCommandEnabled(IDC_PRINT, print_enabled); |
| 1278 #if !defined(OS_WIN) |
1276 command_updater_.UpdateCommandEnabled(IDC_ADVANCED_PRINT, | 1279 command_updater_.UpdateCommandEnabled(IDC_ADVANCED_PRINT, |
1277 CanAdvancedPrint(browser_)); | 1280 CanAdvancedPrint(browser_)); |
1278 command_updater_.UpdateCommandEnabled(IDC_PRINT_TO_DESTINATION, | 1281 #else // !OS_WIN |
1279 print_enabled); | |
1280 #if defined(OS_WIN) | |
1281 HMODULE metro_module = base::win::GetMetroModule(); | 1282 HMODULE metro_module = base::win::GetMetroModule(); |
1282 if (metro_module != NULL) { | 1283 if (metro_module != NULL) { |
1283 typedef void (*MetroEnablePrinting)(BOOL); | 1284 typedef void (*MetroEnablePrinting)(BOOL); |
1284 MetroEnablePrinting metro_enable_printing = | 1285 MetroEnablePrinting metro_enable_printing = |
1285 reinterpret_cast<MetroEnablePrinting>( | 1286 reinterpret_cast<MetroEnablePrinting>( |
1286 ::GetProcAddress(metro_module, "MetroEnablePrinting")); | 1287 ::GetProcAddress(metro_module, "MetroEnablePrinting")); |
1287 if (metro_enable_printing) | 1288 if (metro_enable_printing) |
1288 metro_enable_printing(print_enabled); | 1289 metro_enable_printing(print_enabled); |
1289 } | 1290 } |
1290 #endif | 1291 #endif // !OS_WIN |
1291 } | 1292 } |
1292 | 1293 |
1293 void BrowserCommandController::UpdateSaveAsState() { | 1294 void BrowserCommandController::UpdateSaveAsState() { |
1294 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, CanSavePage(browser_)); | 1295 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, CanSavePage(browser_)); |
1295 } | 1296 } |
1296 | 1297 |
1297 void BrowserCommandController::UpdateShowSyncState(bool show_main_ui) { | 1298 void BrowserCommandController::UpdateShowSyncState(bool show_main_ui) { |
1298 command_updater_.UpdateCommandEnabled( | 1299 command_updater_.UpdateCommandEnabled( |
1299 IDC_SHOW_SYNC_SETUP, show_main_ui && pref_signin_allowed_.GetValue()); | 1300 IDC_SHOW_SYNC_SETUP, show_main_ui && pref_signin_allowed_.GetValue()); |
1300 } | 1301 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 | 1357 |
1357 BrowserWindow* BrowserCommandController::window() { | 1358 BrowserWindow* BrowserCommandController::window() { |
1358 return browser_->window(); | 1359 return browser_->window(); |
1359 } | 1360 } |
1360 | 1361 |
1361 Profile* BrowserCommandController::profile() { | 1362 Profile* BrowserCommandController::profile() { |
1362 return browser_->profile(); | 1363 return browser_->profile(); |
1363 } | 1364 } |
1364 | 1365 |
1365 } // namespace chrome | 1366 } // namespace chrome |
OLD | NEW |