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

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

Issue 113190: Add support for alternate window station. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <commctrl.h> 9 #include <commctrl.h>
10 #endif 10 #endif
11 11
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // see bug #1292702). 277 // see bug #1292702).
278 browser_process.reset(new FirstRunBrowserProcess(parsed_command_line)); 278 browser_process.reset(new FirstRunBrowserProcess(parsed_command_line));
279 is_first_run = false; 279 is_first_run = false;
280 } else { 280 } else {
281 browser_process.reset(new BrowserProcessImpl(parsed_command_line)); 281 browser_process.reset(new BrowserProcessImpl(parsed_command_line));
282 } 282 }
283 283
284 // BrowserProcessImpl's constructor should set g_browser_process. 284 // BrowserProcessImpl's constructor should set g_browser_process.
285 DCHECK(g_browser_process); 285 DCHECK(g_browser_process);
286 286
287 #if defined(OS_WIN)
288 // IMPORTANT: This piece of code needs to run as early as possible in the
289 // process because it will initialize the sandbox broker, which requires the
290 // process to swap its window station. During this time all the UI will be
291 // broken. This has to run before threads and windows are created.
292 sandbox::BrokerServices* broker_services =
293 parameters.sandbox_info_.BrokerServices();
294 if (broker_services) {
295 browser_process->InitBrokerServices(broker_services);
296 if (!parsed_command_line.HasSwitch(switches::kNoSandbox)) {
297 bool use_winsta = !parsed_command_line.HasSwitch(
298 switches::kDisableAltWinstation);
299 // Precreate the desktop and window station used by the renderers.
300 sandbox::TargetPolicy* policy = broker_services->CreatePolicy();
301 sandbox::ResultCode result = policy->CreateAlternateDesktop(use_winsta);
302 CHECK(sandbox::SBOX_ERROR_FAILED_TO_SWITCH_BACK_WINSTATION != result);
303 policy->Release();
304 }
305 }
306 #endif
307
287 std::wstring local_state_path; 308 std::wstring local_state_path;
288 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); 309 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
289 bool local_state_file_exists = file_util::PathExists(local_state_path); 310 bool local_state_file_exists = file_util::PathExists(local_state_path);
290 311
291 // Load local state. This includes the application locale so we know which 312 // Load local state. This includes the application locale so we know which
292 // locale dll to load. 313 // locale dll to load.
293 PrefService* local_state = browser_process->local_state(); 314 PrefService* local_state = browser_process->local_state();
294 DCHECK(local_state); 315 DCHECK(local_state);
295 316
296 // Initialize ResourceBundle which handles files loaded from external 317 // Initialize ResourceBundle which handles files loaded from external
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 577
557 // Config the network module so it has access to resources. 578 // Config the network module so it has access to resources.
558 net::NetModule::SetResourceProvider(NetResourceProvider); 579 net::NetModule::SetResourceProvider(NetResourceProvider);
559 580
560 // Register our global network handler for chrome:// and 581 // Register our global network handler for chrome:// and
561 // chrome-extension:// URLs. 582 // chrome-extension:// URLs.
562 RegisterURLRequestChromeJob(); 583 RegisterURLRequestChromeJob();
563 584
564 #if defined(OS_WIN) 585 #if defined(OS_WIN)
565 RegisterExtensionProtocols(); 586 RegisterExtensionProtocols();
566
567 sandbox::BrokerServices* broker_services =
568 parameters.sandbox_info_.BrokerServices();
569 if (broker_services)
570 browser_process->InitBrokerServices(broker_services);
571 #endif 587 #endif
572 588
573 // In unittest mode, this will do nothing. In normal mode, this will create 589 // In unittest mode, this will do nothing. In normal mode, this will create
574 // the global GoogleURLTracker instance, which will promptly go to sleep for 590 // the global GoogleURLTracker instance, which will promptly go to sleep for
575 // five seconds (to avoid slowing startup), and wake up afterwards to see if 591 // five seconds (to avoid slowing startup), and wake up afterwards to see if
576 // it should do anything else. If we don't cause this creation now, it won't 592 // it should do anything else. If we don't cause this creation now, it won't
577 // happen until someone else asks for the tracker, at which point we may no 593 // happen until someone else asks for the tracker, at which point we may no
578 // longer want to sleep for five seconds. 594 // longer want to sleep for five seconds.
579 // 595 //
580 // A simpler way of doing all this would be to have some function which could 596 // A simpler way of doing all this would be to have some function which could
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 if (metrics) 686 if (metrics)
671 metrics->Stop(); 687 metrics->Stop();
672 688
673 // browser_shutdown takes care of deleting browser_process, so we need to 689 // browser_shutdown takes care of deleting browser_process, so we need to
674 // release it. 690 // release it.
675 browser_process.release(); 691 browser_process.release();
676 browser_shutdown::Shutdown(); 692 browser_shutdown::Shutdown();
677 693
678 return result_code; 694 return result_code;
679 } 695 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sandbox_policy.cc » ('j') | chrome/renderer/renderer_main_platform_delegate_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698