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

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

Issue 6399001: Revert 72624 (due to crashes) - Implement pref policy for disabling incognito... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/common/policy_constants.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_init.h" 5 #include "chrome/browser/ui/browser_init.h"
6 6
7 #include <algorithm> // For max(). 7 #include <algorithm> // For max().
8 8
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/event_recorder.h" 10 #include "base/event_recorder.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 363
364 364
365 // Utility functions ---------------------------------------------------------- 365 // Utility functions ----------------------------------------------------------
366 366
367 SessionStartupPref GetSessionStartupPref(const CommandLine& command_line, 367 SessionStartupPref GetSessionStartupPref(const CommandLine& command_line,
368 Profile* profile) { 368 Profile* profile) {
369 SessionStartupPref pref = SessionStartupPref::GetStartupPref(profile); 369 SessionStartupPref pref = SessionStartupPref::GetStartupPref(profile);
370 if (command_line.HasSwitch(switches::kRestoreLastSession)) 370 if (command_line.HasSwitch(switches::kRestoreLastSession))
371 pref.type = SessionStartupPref::LAST; 371 pref.type = SessionStartupPref::LAST;
372 if (command_line.HasSwitch(switches::kIncognito) && 372 if (command_line.HasSwitch(switches::kIncognito) &&
373 pref.type == SessionStartupPref::LAST && 373 pref.type == SessionStartupPref::LAST) {
374 profile->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled)) {
375 // We don't store session information when incognito. If the user has 374 // We don't store session information when incognito. If the user has
376 // chosen to restore last session and launched incognito, fallback to 375 // chosen to restore last session and launched incognito, fallback to
377 // default launch behavior. 376 // default launch behavior.
378 pref.type = SessionStartupPref::DEFAULT; 377 pref.type = SessionStartupPref::DEFAULT;
379 } 378 }
380 return pref; 379 return pref;
381 } 380 }
382 381
383 enum LaunchMode { 382 enum LaunchMode {
384 LM_TO_BE_DECIDED = 0, // Possibly direct launch or via a shortcut. 383 LM_TO_BE_DECIDED = 0, // Possibly direct launch or via a shortcut.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 // NetworkStateNotifier has to be initialized before Launching browser 477 // NetworkStateNotifier has to be initialized before Launching browser
479 // because the page load can happen in parallel to this UI thread 478 // because the page load can happen in parallel to this UI thread
480 // and IO thread may access the NetworkStateNotifier. 479 // and IO thread may access the NetworkStateNotifier.
481 chromeos::CrosLibrary::Get()->GetNetworkLibrary() 480 chromeos::CrosLibrary::Get()->GetNetworkLibrary()
482 ->AddNetworkManagerObserver( 481 ->AddNetworkManagerObserver(
483 chromeos::NetworkStateNotifier::GetInstance()); 482 chromeos::NetworkStateNotifier::GetInstance());
484 } 483 }
485 #endif 484 #endif
486 485
487 // Continue with the off-the-record profile from here on if --incognito 486 // Continue with the off-the-record profile from here on if --incognito
488 if (command_line.HasSwitch(switches::kIncognito) && 487 if (command_line.HasSwitch(switches::kIncognito))
489 profile->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled)) {
490 profile = profile->GetOffTheRecordProfile(); 488 profile = profile->GetOffTheRecordProfile();
491 }
492 489
493 BrowserInit::LaunchWithProfile lwp(cur_dir, command_line, this); 490 BrowserInit::LaunchWithProfile lwp(cur_dir, command_line, this);
494 bool launched = lwp.Launch(profile, process_startup); 491 bool launched = lwp.Launch(profile, process_startup);
495 in_startup = false; 492 in_startup = false;
496 493
497 if (!launched) { 494 if (!launched) {
498 LOG(ERROR) << "launch error"; 495 LOG(ERROR) << "launch error";
499 if (return_code) 496 if (return_code)
500 *return_code = ResultCodes::INVALID_CMDLINE_URL; 497 *return_code = ResultCodes::INVALID_CMDLINE_URL;
501 return false; 498 return false;
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 return false; 1192 return false;
1196 automation->SetExpectedTabCount(expected_tabs); 1193 automation->SetExpectedTabCount(expected_tabs);
1197 1194
1198 AutomationProviderList* list = 1195 AutomationProviderList* list =
1199 g_browser_process->InitAutomationProviderList(); 1196 g_browser_process->InitAutomationProviderList();
1200 DCHECK(list); 1197 DCHECK(list);
1201 list->AddProvider(automation); 1198 list->AddProvider(automation);
1202 1199
1203 return true; 1200 return true;
1204 } 1201 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/common/policy_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698