| 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 } | 724 } |
| 725 | 725 |
| 726 void Print(Browser* browser) { | 726 void Print(Browser* browser) { |
| 727 printing::PrintViewManager* print_view_manager = | 727 printing::PrintViewManager* print_view_manager = |
| 728 printing::PrintViewManager::FromWebContents( | 728 printing::PrintViewManager::FromWebContents( |
| 729 browser->tab_strip_model()->GetActiveWebContents()); | 729 browser->tab_strip_model()->GetActiveWebContents()); |
| 730 if (browser->profile()->GetPrefs()->GetBoolean( | 730 if (browser->profile()->GetPrefs()->GetBoolean( |
| 731 prefs::kPrintPreviewDisabled)) | 731 prefs::kPrintPreviewDisabled)) |
| 732 print_view_manager->PrintNow(); | 732 print_view_manager->PrintNow(); |
| 733 else | 733 else |
| 734 print_view_manager->PrintPreviewNow(); | 734 print_view_manager->PrintPreviewNow(false); |
| 735 } | 735 } |
| 736 | 736 |
| 737 bool CanPrint(const Browser* browser) { | 737 bool CanPrint(const Browser* browser) { |
| 738 // Do not print when printing is disabled via pref or policy. | 738 // Do not print when printing is disabled via pref or policy. |
| 739 // Do not print when a constrained window is showing. It's confusing. | 739 // Do not print when a constrained window is showing. It's confusing. |
| 740 // Do not print if instant extended API is enabled and mode is NTP. | 740 // Do not print if instant extended API is enabled and mode is NTP. |
| 741 return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) && | 741 return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) && |
| 742 !(IsShowingWebContentsModalDialog(browser) || | 742 !(IsShowingWebContentsModalDialog(browser) || |
| 743 GetContentRestrictions(browser) & content::CONTENT_RESTRICTION_PRINT || | 743 GetContentRestrictions(browser) & content::CONTENT_RESTRICTION_PRINT || |
| 744 IsNTPModeForInstantExtendedAPI(browser)); | 744 IsNTPModeForInstantExtendedAPI(browser)); |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 Browser::CreateParams::CreateForApp( | 1094 Browser::CreateParams::CreateForApp( |
| 1095 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); | 1095 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); |
| 1096 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1096 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1097 | 1097 |
| 1098 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1098 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1099 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1099 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1100 app_browser->window()->Show(); | 1100 app_browser->window()->Show(); |
| 1101 } | 1101 } |
| 1102 | 1102 |
| 1103 } // namespace chrome | 1103 } // namespace chrome |
| OLD | NEW |