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

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

Issue 10483006: Print support for Windows Metro... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self CR changes 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.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 case IDC_SAVE_PAGE: chrome::SavePage(this); break; 1382 case IDC_SAVE_PAGE: chrome::SavePage(this); break;
1383 case IDC_BOOKMARK_PAGE: chrome::BookmarkCurrentPage(this);break; 1383 case IDC_BOOKMARK_PAGE: chrome::BookmarkCurrentPage(this);break;
1384 case IDC_PIN_TO_START_SCREEN: 1384 case IDC_PIN_TO_START_SCREEN:
1385 chrome::PinCurrentPageToStartScreen(this); 1385 chrome::PinCurrentPageToStartScreen(this);
1386 break; 1386 break;
1387 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break; 1387 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break;
1388 case IDC_VIEW_SOURCE: chrome::ViewSelectedSource(this); break; 1388 case IDC_VIEW_SOURCE: chrome::ViewSelectedSource(this); break;
1389 case IDC_EMAIL_PAGE_LOCATION: chrome::EmailPageLocation(this); break; 1389 case IDC_EMAIL_PAGE_LOCATION: chrome::EmailPageLocation(this); break;
1390 case IDC_PRINT: chrome::Print(this); break; 1390 case IDC_PRINT: chrome::Print(this); break;
1391 case IDC_ADVANCED_PRINT: chrome::AdvancedPrint(this); break; 1391 case IDC_ADVANCED_PRINT: chrome::AdvancedPrint(this); break;
1392 case IDC_PRINT_TO_DESTINATION: chrome::PrintToDestination(this); break;
1392 case IDC_CHROME_TO_MOBILE_PAGE: 1393 case IDC_CHROME_TO_MOBILE_PAGE:
1393 chrome::ShowChromeToMobileBubble(this); 1394 chrome::ShowChromeToMobileBubble(this);
1394 break; 1395 break;
1395 case IDC_ENCODING_AUTO_DETECT: ToggleEncodingAutoDetect(); break; 1396 case IDC_ENCODING_AUTO_DETECT: ToggleEncodingAutoDetect(); break;
1396 case IDC_ENCODING_UTF8: 1397 case IDC_ENCODING_UTF8:
1397 case IDC_ENCODING_UTF16LE: 1398 case IDC_ENCODING_UTF16LE:
1398 case IDC_ENCODING_ISO88591: 1399 case IDC_ENCODING_ISO88591:
1399 case IDC_ENCODING_WINDOWS1252: 1400 case IDC_ENCODING_WINDOWS1252:
1400 case IDC_ENCODING_GBK: 1401 case IDC_ENCODING_GBK:
1401 case IDC_ENCODING_GB18030: 1402 case IDC_ENCODING_GB18030:
(...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after
3333 3334
3334 // The exception is print preview, 3335 // The exception is print preview,
3335 // where advanced printing is always enabled. 3336 // where advanced printing is always enabled.
3336 printing::PrintPreviewTabController* controller = 3337 printing::PrintPreviewTabController* controller =
3337 printing::PrintPreviewTabController::GetInstance(); 3338 printing::PrintPreviewTabController::GetInstance();
3338 if (controller && (controller->GetPrintPreviewForTab(tab_contents) || 3339 if (controller && (controller->GetPrintPreviewForTab(tab_contents) ||
3339 controller->is_creating_print_preview_tab())) { 3340 controller->is_creating_print_preview_tab())) {
3340 advanced_print_enabled = true; 3341 advanced_print_enabled = true;
3341 } 3342 }
3342 } 3343 }
3344 #if defined(OS_WIN)
3345 HMODULE metro_module = base::win::GetMetroModule();
3346 if (metro_module != NULL) {
3347 typedef void (*MetroEnablePrinting)(BOOL);
3348 MetroEnablePrinting metro_enable_printing =
3349 reinterpret_cast<MetroEnablePrinting>(
3350 ::GetProcAddress(metro_module, "MetroEnablePrinting"));
3351 if (metro_enable_printing)
3352 metro_enable_printing(print_enabled);
3353 }
3354 #endif
3343 command_updater_.UpdateCommandEnabled(IDC_PRINT, print_enabled); 3355 command_updater_.UpdateCommandEnabled(IDC_PRINT, print_enabled);
3344 command_updater_.UpdateCommandEnabled(IDC_ADVANCED_PRINT, 3356 command_updater_.UpdateCommandEnabled(IDC_ADVANCED_PRINT,
3345 advanced_print_enabled); 3357 advanced_print_enabled);
3358 command_updater_.UpdateCommandEnabled(IDC_PRINT_TO_DESTINATION,
robertshield 2012/06/28 17:48:54 should this command be enabled under the same is-i
MAD 2012/06/28 19:05:51 Why? We may have other destinations, not just metr
3359 print_enabled);
3346 } 3360 }
3347 3361
3348 void Browser::UpdateSaveAsState(int content_restrictions) { 3362 void Browser::UpdateSaveAsState(int content_restrictions) {
3349 bool enabled = !(content_restrictions & content::CONTENT_RESTRICTION_SAVE); 3363 bool enabled = !(content_restrictions & content::CONTENT_RESTRICTION_SAVE);
3350 enabled = enabled && CanSaveContents(GetActiveTabContents()); 3364 enabled = enabled && CanSaveContents(GetActiveTabContents());
3351 PrefService* state = g_browser_process->local_state(); 3365 PrefService* state = g_browser_process->local_state();
3352 if (state) 3366 if (state)
3353 enabled = enabled && state->GetBoolean(prefs::kAllowFileSelectionDialogs); 3367 enabled = enabled && state->GetBoolean(prefs::kAllowFileSelectionDialogs);
3354 3368
3355 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, enabled); 3369 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, enabled);
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
3899 if (contents && !allow_js_access) { 3913 if (contents && !allow_js_access) {
3900 contents->web_contents()->GetController().LoadURL( 3914 contents->web_contents()->GetController().LoadURL(
3901 target_url, 3915 target_url,
3902 content::Referrer(), 3916 content::Referrer(),
3903 content::PAGE_TRANSITION_LINK, 3917 content::PAGE_TRANSITION_LINK,
3904 std::string()); // No extra headers. 3918 std::string()); // No extra headers.
3905 } 3919 }
3906 3920
3907 return contents != NULL; 3921 return contents != NULL;
3908 } 3922 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698