| OLD | NEW |
| 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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 if (!browser->popup_manager()) | 261 if (!browser->popup_manager()) |
| 262 return false; | 262 return false; |
| 263 | 263 |
| 264 // TODO(gbillock): This is currently called in production by the CanPrint | 264 // TODO(gbillock): This is currently called in production by the CanPrint |
| 265 // method, and may be too restrictive if we allow print preview to overlap. | 265 // method, and may be too restrictive if we allow print preview to overlap. |
| 266 // Re-assess how to queue print preview after we know more about popup | 266 // Re-assess how to queue print preview after we know more about popup |
| 267 // management policy. | 267 // management policy. |
| 268 return browser->popup_manager()->IsWebModalDialogActive(web_contents); | 268 return browser->popup_manager()->IsWebModalDialogActive(web_contents); |
| 269 } | 269 } |
| 270 | 270 |
| 271 #if defined(ENABLE_BASIC_PRINTING) |
| 271 bool PrintPreviewShowing(const Browser* browser) { | 272 bool PrintPreviewShowing(const Browser* browser) { |
| 272 #if defined(ENABLE_PRINT_PREVIEW) | 273 #if defined(ENABLE_PRINT_PREVIEW) |
| 273 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); | 274 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); |
| 274 printing::PrintPreviewDialogController* controller = | 275 printing::PrintPreviewDialogController* controller = |
| 275 printing::PrintPreviewDialogController::GetInstance(); | 276 printing::PrintPreviewDialogController::GetInstance(); |
| 276 return controller && (controller->GetPrintPreviewForContents(contents) || | 277 return controller && (controller->GetPrintPreviewForContents(contents) || |
| 277 controller->is_creating_print_preview_dialog()); | 278 controller->is_creating_print_preview_dialog()); |
| 278 #else | 279 #else |
| 279 return false; | 280 return false; |
| 280 #endif | 281 #endif |
| 281 } | 282 } |
| 283 #endif // ENABLE_BASIC_PRINTING |
| 282 | 284 |
| 283 } // namespace | 285 } // namespace |
| 284 | 286 |
| 285 bool IsCommandEnabled(Browser* browser, int command) { | 287 bool IsCommandEnabled(Browser* browser, int command) { |
| 286 return browser->command_controller()->command_updater()->IsCommandEnabled( | 288 return browser->command_controller()->command_updater()->IsCommandEnabled( |
| 287 command); | 289 command); |
| 288 } | 290 } |
| 289 | 291 |
| 290 bool SupportsCommand(Browser* browser, int command) { | 292 bool SupportsCommand(Browser* browser, int command) { |
| 291 return browser->command_controller()->command_updater()->SupportsCommand( | 293 return browser->command_controller()->command_updater()->SupportsCommand( |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 browser->host_desktop_type())); | 1290 browser->host_desktop_type())); |
| 1289 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1291 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1290 | 1292 |
| 1291 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1293 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1292 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1294 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1293 app_browser->window()->Show(); | 1295 app_browser->window()->Show(); |
| 1294 } | 1296 } |
| 1295 #endif // defined(ENABLE_EXTENSIONS) | 1297 #endif // defined(ENABLE_EXTENSIONS) |
| 1296 | 1298 |
| 1297 } // namespace chrome | 1299 } // namespace chrome |
| OLD | NEW |