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

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

Issue 22577010: Printing: Add a basic printing mode without print preview and cloud print. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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
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/startup/startup_browser_creator.h" 5 #include "chrome/browser/ui/startup/startup_browser_creator.h"
6 6
7 #include <algorithm> // For max(). 7 #include <algorithm> // For max().
8 #include <set> 8 #include <set>
9 9
10 #include "apps/app_load_service.h" 10 #include "apps/app_load_service.h"
(...skipping 22 matching lines...) Expand all
33 #include "chrome/browser/browser_process.h" 33 #include "chrome/browser/browser_process.h"
34 #include "chrome/browser/chrome_notification_types.h" 34 #include "chrome/browser/chrome_notification_types.h"
35 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 35 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
36 #include "chrome/browser/extensions/startup_helper.h" 36 #include "chrome/browser/extensions/startup_helper.h"
37 #include "chrome/browser/extensions/unpacked_installer.h" 37 #include "chrome/browser/extensions/unpacked_installer.h"
38 #include "chrome/browser/first_run/first_run.h" 38 #include "chrome/browser/first_run/first_run.h"
39 #include "chrome/browser/google/google_util.h" 39 #include "chrome/browser/google/google_util.h"
40 #include "chrome/browser/notifications/desktop_notification_service.h" 40 #include "chrome/browser/notifications/desktop_notification_service.h"
41 #include "chrome/browser/prefs/incognito_mode_prefs.h" 41 #include "chrome/browser/prefs/incognito_mode_prefs.h"
42 #include "chrome/browser/prefs/session_startup_pref.h" 42 #include "chrome/browser/prefs/session_startup_pref.h"
43 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
44 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h"
45 #include "chrome/browser/printing/print_dialog_cloud.h"
46 #include "chrome/browser/profiles/profile.h" 43 #include "chrome/browser/profiles/profile.h"
47 #include "chrome/browser/profiles/profile_manager.h" 44 #include "chrome/browser/profiles/profile_manager.h"
48 #include "chrome/browser/search_engines/util.h" 45 #include "chrome/browser/search_engines/util.h"
49 #include "chrome/browser/ui/browser.h" 46 #include "chrome/browser/ui/browser.h"
50 #include "chrome/browser/ui/browser_finder.h" 47 #include "chrome/browser/ui/browser_finder.h"
51 #include "chrome/browser/ui/browser_window.h" 48 #include "chrome/browser/ui/browser_window.h"
52 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" 49 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
53 #include "chrome/common/chrome_constants.h" 50 #include "chrome/common/chrome_constants.h"
54 #include "chrome/common/chrome_paths.h" 51 #include "chrome/common/chrome_paths.h"
55 #include "chrome/common/chrome_result_codes.h" 52 #include "chrome/common/chrome_result_codes.h"
(...skipping 21 matching lines...) Expand all
77 74
78 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) 75 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX)
79 #include "ui/base/touch/touch_factory_x11.h" 76 #include "ui/base/touch/touch_factory_x11.h"
80 #endif 77 #endif
81 78
82 #if defined(OS_WIN) 79 #if defined(OS_WIN)
83 #include "chrome/browser/automation/chrome_frame_automation_provider_win.h" 80 #include "chrome/browser/automation/chrome_frame_automation_provider_win.h"
84 #include "chrome/browser/ui/startup/startup_browser_creator_win.h" 81 #include "chrome/browser/ui/startup/startup_browser_creator_win.h"
85 #endif 82 #endif
86 83
84 #if defined(ENABLE_FULL_PRINTING)
85 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
86 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h"
87 #include "chrome/browser/printing/print_dialog_cloud.h"
88 #endif
89
87 using content::BrowserThread; 90 using content::BrowserThread;
88 using content::ChildProcessSecurityPolicy; 91 using content::ChildProcessSecurityPolicy;
89 92
90 namespace { 93 namespace {
91 94
92 // Keeps track on which profiles have been launched. 95 // Keeps track on which profiles have been launched.
93 class ProfileLaunchObserver : public content::NotificationObserver { 96 class ProfileLaunchObserver : public content::NotificationObserver {
94 public: 97 public:
95 ProfileLaunchObserver() 98 ProfileLaunchObserver()
96 : profile_to_activate_(NULL), 99 : profile_to_activate_(NULL),
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 return false; 522 return false;
520 #endif 523 #endif
521 } else { 524 } else {
522 if (!CreateAutomationProvider<AutomationProvider>( 525 if (!CreateAutomationProvider<AutomationProvider>(
523 automation_channel_id, last_used_profile, expected_tabs)) 526 automation_channel_id, last_used_profile, expected_tabs))
524 return false; 527 return false;
525 } 528 }
526 } 529 }
527 #endif // defined(ENABLE_AUTOMATION) 530 #endif // defined(ENABLE_AUTOMATION)
528 531
532 #if defined(ENABLE_FULL_PRINTING)
529 // If we are just displaying a print dialog we shouldn't open browser 533 // If we are just displaying a print dialog we shouldn't open browser
530 // windows. 534 // windows.
531 if (command_line.HasSwitch(switches::kCloudPrintFile) && 535 if (command_line.HasSwitch(switches::kCloudPrintFile) &&
532 print_dialog_cloud::CreatePrintDialogFromCommandLine(command_line)) { 536 print_dialog_cloud::CreatePrintDialogFromCommandLine(command_line)) {
533 silent_launch = true; 537 silent_launch = true;
534 } 538 }
535 539
536 // If we are checking the proxy enabled policy, don't open any windows. 540 // If we are checking the proxy enabled policy, don't open any windows.
537 if (command_line.HasSwitch(switches::kCheckCloudPrintConnectorPolicy)) { 541 if (command_line.HasSwitch(switches::kCheckCloudPrintConnectorPolicy)) {
538 silent_launch = true; 542 silent_launch = true;
539 if (CloudPrintProxyServiceFactory::GetForProfile(last_used_profile)-> 543 if (CloudPrintProxyServiceFactory::GetForProfile(last_used_profile)->
540 EnforceCloudPrintConnectorPolicyAndQuit()) 544 EnforceCloudPrintConnectorPolicyAndQuit())
541 // Success, nothing more needs to be done, so return false to stop 545 // Success, nothing more needs to be done, so return false to stop
542 // launching and quit. 546 // launching and quit.
543 return false; 547 return false;
544 } 548 }
549 #endif // defined(ENABLE_FULL_PRINTING)
545 550
546 if (command_line.HasSwitch(switches::kExplicitlyAllowedPorts)) { 551 if (command_line.HasSwitch(switches::kExplicitlyAllowedPorts)) {
547 std::string allowed_ports = 552 std::string allowed_ports =
548 command_line.GetSwitchValueASCII(switches::kExplicitlyAllowedPorts); 553 command_line.GetSwitchValueASCII(switches::kExplicitlyAllowedPorts);
549 net::SetExplicitlyAllowedPorts(allowed_ports); 554 net::SetExplicitlyAllowedPorts(allowed_ports);
550 } 555 }
551 556
552 if (command_line.HasSwitch(switches::kInstallFromWebstore)) { 557 if (command_line.HasSwitch(switches::kInstallFromWebstore)) {
553 extensions::StartupHelper helper; 558 extensions::StartupHelper helper;
554 helper.InstallFromWebstore(command_line, last_used_profile); 559 helper.InstallFromWebstore(command_line, last_used_profile);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 744
740 // static 745 // static
741 bool StartupBrowserCreator::ActivatedProfile() { 746 bool StartupBrowserCreator::ActivatedProfile() {
742 return profile_launch_observer.Get().activated_profile(); 747 return profile_launch_observer.Get().activated_profile();
743 } 748 }
744 749
745 bool HasPendingUncleanExit(Profile* profile) { 750 bool HasPendingUncleanExit(Profile* profile) {
746 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && 751 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED &&
747 !profile_launch_observer.Get().HasBeenLaunched(profile); 752 !profile_launch_observer.Get().HasBeenLaunched(profile);
748 } 753 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698