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

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

Issue 2398743002: Disable Ctrl+Shift+P on Chrome OS (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/print_preview/print_preview_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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_commands.h" 5 #include "chrome/browser/ui/browser_commands.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "chrome/browser/ui/location_bar/location_bar.h" 46 #include "chrome/browser/ui/location_bar/location_bar.h"
47 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 47 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
48 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 48 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
49 #include "chrome/browser/ui/search/search_tab_helper.h" 49 #include "chrome/browser/ui/search/search_tab_helper.h"
50 #include "chrome/browser/ui/status_bubble.h" 50 #include "chrome/browser/ui/status_bubble.h"
51 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 51 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
52 #include "chrome/browser/ui/tab_dialogs.h" 52 #include "chrome/browser/ui/tab_dialogs.h"
53 #include "chrome/browser/ui/tabs/tab_strip_model.h" 53 #include "chrome/browser/ui/tabs/tab_strip_model.h"
54 #include "chrome/browser/upgrade_detector.h" 54 #include "chrome/browser/upgrade_detector.h"
55 #include "chrome/common/content_restriction.h" 55 #include "chrome/common/content_restriction.h"
56 #include "chrome/common/features.h"
56 #include "chrome/common/pref_names.h" 57 #include "chrome/common/pref_names.h"
57 #include "components/bookmarks/browser/bookmark_model.h" 58 #include "components/bookmarks/browser/bookmark_model.h"
58 #include "components/bookmarks/browser/bookmark_utils.h" 59 #include "components/bookmarks/browser/bookmark_utils.h"
59 #include "components/bookmarks/common/bookmark_pref_names.h" 60 #include "components/bookmarks/common/bookmark_pref_names.h"
60 #include "components/favicon/content/content_favicon_driver.h" 61 #include "components/favicon/content/content_favicon_driver.h"
61 #include "components/google/core/browser/google_util.h" 62 #include "components/google/core/browser/google_util.h"
62 #include "components/prefs/pref_service.h" 63 #include "components/prefs/pref_service.h"
63 #include "components/sessions/core/live_tab_context.h" 64 #include "components/sessions/core/live_tab_context.h"
64 #include "components/sessions/core/tab_restore_service.h" 65 #include "components/sessions/core/tab_restore_service.h"
65 #include "components/signin/core/browser/signin_header_helper.h" 66 #include "components/signin/core/browser/signin_header_helper.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 245
245 // TODO(gbillock): This is currently called in production by the CanPrint 246 // TODO(gbillock): This is currently called in production by the CanPrint
246 // method, and may be too restrictive if we allow print preview to overlap. 247 // method, and may be too restrictive if we allow print preview to overlap.
247 // Re-assess how to queue print preview after we know more about popup 248 // Re-assess how to queue print preview after we know more about popup
248 // management policy. 249 // management policy.
249 const web_modal::WebContentsModalDialogManager* manager = 250 const web_modal::WebContentsModalDialogManager* manager =
250 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); 251 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents);
251 return manager && manager->IsDialogActive(); 252 return manager && manager->IsDialogActive();
252 } 253 }
253 254
254 #if defined(ENABLE_BASIC_PRINTING) 255 #if BUILDFLAG(ENABLE_BASIC_PRINT_DIALOG)
255 bool PrintPreviewShowing(const Browser* browser) { 256 bool PrintPreviewShowing(const Browser* browser) {
256 #if defined(ENABLE_PRINT_PREVIEW) 257 #if defined(ENABLE_PRINT_PREVIEW)
257 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); 258 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents();
258 printing::PrintPreviewDialogController* controller = 259 printing::PrintPreviewDialogController* controller =
259 printing::PrintPreviewDialogController::GetInstance(); 260 printing::PrintPreviewDialogController::GetInstance();
260 return controller && (controller->GetPrintPreviewForContents(contents) || 261 return controller && (controller->GetPrintPreviewForContents(contents) ||
261 controller->is_creating_print_preview_dialog()); 262 controller->is_creating_print_preview_dialog());
262 #else 263 #else
263 return false; 264 return false;
264 #endif 265 #endif
265 } 266 }
266 #endif // ENABLE_BASIC_PRINTING 267 #endif // BUILDFLAG(ENABLE_BASIC_PRINT_DIALOG)
267 268
268 } // namespace 269 } // namespace
269 270
270 bool IsCommandEnabled(Browser* browser, int command) { 271 bool IsCommandEnabled(Browser* browser, int command) {
271 return browser->command_controller()->command_updater()->IsCommandEnabled( 272 return browser->command_controller()->command_updater()->IsCommandEnabled(
272 command); 273 command);
273 } 274 }
274 275
275 bool SupportsCommand(Browser* browser, int command) { 276 bool SupportsCommand(Browser* browser, int command) {
276 return browser->command_controller()->command_updater()->SupportsCommand( 277 return browser->command_controller()->command_updater()->SupportsCommand(
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 !(IsShowingWebContentsModalDialog(browser) || 893 !(IsShowingWebContentsModalDialog(browser) ||
893 GetContentRestrictions(browser) & CONTENT_RESTRICTION_PRINT); 894 GetContentRestrictions(browser) & CONTENT_RESTRICTION_PRINT);
894 } 895 }
895 896
896 #if defined(ENABLE_BASIC_PRINTING) 897 #if defined(ENABLE_BASIC_PRINTING)
897 void BasicPrint(Browser* browser) { 898 void BasicPrint(Browser* browser) {
898 printing::StartBasicPrint(browser->tab_strip_model()->GetActiveWebContents()); 899 printing::StartBasicPrint(browser->tab_strip_model()->GetActiveWebContents());
899 } 900 }
900 901
901 bool CanBasicPrint(Browser* browser) { 902 bool CanBasicPrint(Browser* browser) {
903 #if BUILDFLAG(ENABLE_BASIC_PRINT_DIALOG)
902 // If printing is not disabled via pref or policy, it is always possible to 904 // If printing is not disabled via pref or policy, it is always possible to
903 // advanced print when the print preview is visible. 905 // advanced print when the print preview is visible.
904 return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) && 906 return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) &&
905 (PrintPreviewShowing(browser) || CanPrint(browser)); 907 (PrintPreviewShowing(browser) || CanPrint(browser));
908 #else
909 return false; // The print dialog is disabled.
910 #endif // BUILDFLAG(ENABLE_BASIC_PRINT_DIALOG)
906 } 911 }
907 #endif // ENABLE_BASIC_PRINTING 912 #endif // defined(ENABLE_BASIC_PRINTING)
908 913
909 bool CanRouteMedia(Browser* browser) { 914 bool CanRouteMedia(Browser* browser) {
910 // Do not allow user to open Media Router dialog when there is already an 915 // Do not allow user to open Media Router dialog when there is already an
911 // active modal dialog. This avoids overlapping dialogs. 916 // active modal dialog. This avoids overlapping dialogs.
912 return media_router::MediaRouterEnabled(browser->profile()) && 917 return media_router::MediaRouterEnabled(browser->profile()) &&
913 !IsShowingWebContentsModalDialog(browser); 918 !IsShowingWebContentsModalDialog(browser);
914 } 919 }
915 920
916 void RouteMedia(Browser* browser) { 921 void RouteMedia(Browser* browser) {
917 #if defined(ENABLE_MEDIA_ROUTER) 922 #if defined(ENABLE_MEDIA_ROUTER)
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); 1295 app_name, true /* trusted_source */, gfx::Rect(), browser->profile()));
1291 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1296 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1292 1297
1293 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1298 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1294 contents->GetRenderViewHost()->SyncRendererPrefs(); 1299 contents->GetRenderViewHost()->SyncRendererPrefs();
1295 app_browser->window()->Show(); 1300 app_browser->window()->Show();
1296 } 1301 }
1297 #endif // defined(ENABLE_EXTENSIONS) 1302 #endif // defined(ENABLE_EXTENSIONS)
1298 1303
1299 } // namespace chrome 1304 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/print_preview/print_preview_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698