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 "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/defaults.h" | 9 #include "chrome/browser/defaults.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 break; | 364 break; |
365 case IDC_EMAIL_PAGE_LOCATION: | 365 case IDC_EMAIL_PAGE_LOCATION: |
366 EmailPageLocation(browser_); | 366 EmailPageLocation(browser_); |
367 break; | 367 break; |
368 case IDC_PRINT: | 368 case IDC_PRINT: |
369 Print(browser_); | 369 Print(browser_); |
370 break; | 370 break; |
371 case IDC_ADVANCED_PRINT: | 371 case IDC_ADVANCED_PRINT: |
372 AdvancedPrint(browser_); | 372 AdvancedPrint(browser_); |
373 break; | 373 break; |
| 374 case IDC_PRINT_TO_DESTINATION: |
| 375 PrintToDestination(browser_); |
| 376 break; |
374 case IDC_CHROME_TO_MOBILE_PAGE: | 377 case IDC_CHROME_TO_MOBILE_PAGE: |
375 ShowChromeToMobileBubble(browser_); | 378 ShowChromeToMobileBubble(browser_); |
376 break; | 379 break; |
377 case IDC_ENCODING_AUTO_DETECT: | 380 case IDC_ENCODING_AUTO_DETECT: |
378 browser_->ToggleEncodingAutoDetect(); | 381 browser_->ToggleEncodingAutoDetect(); |
379 break; | 382 break; |
380 case IDC_ENCODING_UTF8: | 383 case IDC_ENCODING_UTF8: |
381 case IDC_ENCODING_UTF16LE: | 384 case IDC_ENCODING_UTF16LE: |
382 case IDC_ENCODING_ISO88591: | 385 case IDC_ENCODING_ISO88591: |
383 case IDC_ENCODING_WINDOWS1252: | 386 case IDC_ENCODING_WINDOWS1252: |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 | 1009 |
1007 void BrowserCommandController::UpdateCommandsForMultipleProfiles() { | 1010 void BrowserCommandController::UpdateCommandsForMultipleProfiles() { |
1008 bool show_main_ui = IsShowingMainUI(window() && window()->IsFullscreen()); | 1011 bool show_main_ui = IsShowingMainUI(window() && window()->IsFullscreen()); |
1009 command_updater_.UpdateCommandEnabled(IDC_SHOW_AVATAR_MENU, | 1012 command_updater_.UpdateCommandEnabled(IDC_SHOW_AVATAR_MENU, |
1010 show_main_ui && | 1013 show_main_ui && |
1011 !profile()->IsOffTheRecord() && | 1014 !profile()->IsOffTheRecord() && |
1012 ProfileManager::IsMultipleProfilesEnabled()); | 1015 ProfileManager::IsMultipleProfilesEnabled()); |
1013 } | 1016 } |
1014 | 1017 |
1015 void BrowserCommandController::UpdatePrintingState() { | 1018 void BrowserCommandController::UpdatePrintingState() { |
1016 command_updater_.UpdateCommandEnabled(IDC_PRINT, CanPrint(browser_)); | 1019 bool print_enabled = CanPrint(browser_); |
| 1020 command_updater_.UpdateCommandEnabled(IDC_PRINT, print_enabled); |
1017 command_updater_.UpdateCommandEnabled(IDC_ADVANCED_PRINT, | 1021 command_updater_.UpdateCommandEnabled(IDC_ADVANCED_PRINT, |
1018 CanAdvancedPrint(browser_)); | 1022 CanAdvancedPrint(browser_)); |
| 1023 command_updater_.UpdateCommandEnabled(IDC_PRINT_TO_DESTINATION, |
| 1024 print_enabled); |
| 1025 #if defined(OS_WIN) |
| 1026 HMODULE metro_module = base::win::GetMetroModule(); |
| 1027 if (metro_module != NULL) { |
| 1028 typedef void (*MetroEnablePrinting)(BOOL); |
| 1029 MetroEnablePrinting metro_enable_printing = |
| 1030 reinterpret_cast<MetroEnablePrinting>( |
| 1031 ::GetProcAddress(metro_module, "MetroEnablePrinting")); |
| 1032 if (metro_enable_printing) |
| 1033 metro_enable_printing(print_enabled); |
| 1034 } |
| 1035 #endif |
1019 } | 1036 } |
1020 | 1037 |
1021 void BrowserCommandController::UpdateSaveAsState() { | 1038 void BrowserCommandController::UpdateSaveAsState() { |
1022 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, CanSavePage(browser_)); | 1039 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, CanSavePage(browser_)); |
1023 } | 1040 } |
1024 | 1041 |
1025 void BrowserCommandController::UpdateOpenFileState() { | 1042 void BrowserCommandController::UpdateOpenFileState() { |
1026 bool enabled = true; | 1043 bool enabled = true; |
1027 PrefService* local_state = g_browser_process->local_state(); | 1044 PrefService* local_state = g_browser_process->local_state(); |
1028 if (local_state) | 1045 if (local_state) |
(...skipping 25 matching lines...) Expand all Loading... |
1054 | 1071 |
1055 BrowserWindow* BrowserCommandController::window() { | 1072 BrowserWindow* BrowserCommandController::window() { |
1056 return browser_->window(); | 1073 return browser_->window(); |
1057 } | 1074 } |
1058 | 1075 |
1059 Profile* BrowserCommandController::profile() { | 1076 Profile* BrowserCommandController::profile() { |
1060 return browser_->profile(); | 1077 return browser_->profile(); |
1061 } | 1078 } |
1062 | 1079 |
1063 } // namespace chrome | 1080 } // namespace chrome |
OLD | NEW |