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

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

Issue 10690060: startup: Put it in chrome namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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) 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 "base/bind.h" 10 #include "base/bind.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 // static 168 // static
169 bool StartupBrowserCreator::InSynchronousProfileLaunch() { 169 bool StartupBrowserCreator::InSynchronousProfileLaunch() {
170 return in_synchronous_profile_launch; 170 return in_synchronous_profile_launch;
171 } 171 }
172 172
173 bool StartupBrowserCreator::LaunchBrowser( 173 bool StartupBrowserCreator::LaunchBrowser(
174 const CommandLine& command_line, 174 const CommandLine& command_line,
175 Profile* profile, 175 Profile* profile,
176 const FilePath& cur_dir, 176 const FilePath& cur_dir,
177 browser::startup::IsProcessStartup process_startup, 177 chrome::startup::IsProcessStartup process_startup,
178 browser::startup::IsFirstRun is_first_run, 178 chrome::startup::IsFirstRun is_first_run,
179 int* return_code) { 179 int* return_code) {
180 in_synchronous_profile_launch = 180 in_synchronous_profile_launch =
181 process_startup == browser::startup::IS_PROCESS_STARTUP; 181 process_startup == chrome::startup::IS_PROCESS_STARTUP;
182 DCHECK(profile); 182 DCHECK(profile);
183 183
184 // Continue with the incognito profile from here on if Incognito mode 184 // Continue with the incognito profile from here on if Incognito mode
185 // is forced. 185 // is forced.
186 if (IncognitoModePrefs::ShouldLaunchIncognito(command_line, 186 if (IncognitoModePrefs::ShouldLaunchIncognito(command_line,
187 profile->GetPrefs())) { 187 profile->GetPrefs())) {
188 profile = profile->GetOffTheRecordProfile(); 188 profile = profile->GetOffTheRecordProfile();
189 } else if (command_line.HasSwitch(switches::kIncognito)) { 189 } else if (command_line.HasSwitch(switches::kIncognito)) {
190 LOG(WARNING) << "Incognito mode disabled by policy, launching a normal " 190 LOG(WARNING) << "Incognito mode disabled by policy, launching a normal "
191 << "browser session."; 191 << "browser session.";
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 (url.spec().compare(chrome::kAboutBlankURL) == 0)) { 307 (url.spec().compare(chrome::kAboutBlankURL) == 0)) {
308 urls.push_back(url); 308 urls.push_back(url);
309 } 309 }
310 } 310 }
311 } 311 }
312 #if defined(OS_WIN) 312 #if defined(OS_WIN)
313 if (urls.empty()) { 313 if (urls.empty()) {
314 // If we are in Windows 8 metro mode and were launched as a result of the 314 // If we are in Windows 8 metro mode and were launched as a result of the
315 // search charm or via a url navigation in metro, then fetch the 315 // search charm or via a url navigation in metro, then fetch the
316 // corresponding url. 316 // corresponding url.
317 GURL url = browser::GetURLToOpen(profile); 317 GURL url = chrome::GetURLToOpen(profile);
318 if (url.is_valid()) 318 if (url.is_valid())
319 urls.push_back(GURL(url)); 319 urls.push_back(GURL(url));
320 } 320 }
321 #endif // OS_WIN 321 #endif // OS_WIN
322 return urls; 322 return urls;
323 } 323 }
324 324
325 // static 325 // static
326 bool StartupBrowserCreator::ProcessCmdLineImpl( 326 bool StartupBrowserCreator::ProcessCmdLineImpl(
327 const CommandLine& command_line, 327 const CommandLine& command_line,
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } 443 }
444 #endif 444 #endif
445 445
446 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) 446 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX)
447 ui::TouchFactory::SetTouchDeviceListFromCommandLine(); 447 ui::TouchFactory::SetTouchDeviceListFromCommandLine();
448 #endif 448 #endif
449 449
450 // If we don't want to launch a new browser window or tab (in the case 450 // If we don't want to launch a new browser window or tab (in the case
451 // of an automation request), we are done here. 451 // of an automation request), we are done here.
452 if (!silent_launch) { 452 if (!silent_launch) {
453 browser::startup::IsProcessStartup is_process_startup = process_startup ? 453 chrome::startup::IsProcessStartup is_process_startup = process_startup ?
454 browser::startup::IS_PROCESS_STARTUP : 454 chrome::startup::IS_PROCESS_STARTUP :
455 browser::startup::IS_NOT_PROCESS_STARTUP; 455 chrome::startup::IS_NOT_PROCESS_STARTUP;
456 browser::startup::IsFirstRun is_first_run = first_run::IsChromeFirstRun() ? 456 chrome::startup::IsFirstRun is_first_run = first_run::IsChromeFirstRun() ?
457 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; 457 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
458 // |last_opened_profiles| will be empty in the following circumstances: 458 // |last_opened_profiles| will be empty in the following circumstances:
459 // - This is the first launch. |last_used_profile| is the initial profile. 459 // - This is the first launch. |last_used_profile| is the initial profile.
460 // - The user exited the browser by closing all windows for all 460 // - The user exited the browser by closing all windows for all
461 // profiles. |last_used_profile| is the profile which owned the last open 461 // profiles. |last_used_profile| is the profile which owned the last open
462 // window. 462 // window.
463 // - Only incognito windows were open when the browser exited. 463 // - Only incognito windows were open when the browser exited.
464 // |last_used_profile| is the last used incognito profile. Restoring it will 464 // |last_used_profile| is the last used incognito profile. Restoring it will
465 // create a browser window for the corresponding original profile. 465 // create a browser window for the corresponding original profile.
466 if (last_opened_profiles.empty()) { 466 if (last_opened_profiles.empty()) {
467 if (!browser_creator->LaunchBrowser(command_line, last_used_profile, 467 if (!browser_creator->LaunchBrowser(command_line, last_used_profile,
(...skipping 21 matching lines...) Expand all
489 GetSessionStartupPref(command_line, *it); 489 GetSessionStartupPref(command_line, *it);
490 if (*it != last_used_profile && 490 if (*it != last_used_profile &&
491 startup_pref.type == SessionStartupPref::DEFAULT && 491 startup_pref.type == SessionStartupPref::DEFAULT &&
492 !HasPendingUncleanExit(*it)) 492 !HasPendingUncleanExit(*it))
493 continue; 493 continue;
494 if (!browser_creator->LaunchBrowser((*it == last_used_profile) ? 494 if (!browser_creator->LaunchBrowser((*it == last_used_profile) ?
495 command_line : command_line_without_urls, *it, cur_dir, 495 command_line : command_line_without_urls, *it, cur_dir,
496 is_process_startup, is_first_run, return_code)) 496 is_process_startup, is_first_run, return_code))
497 return false; 497 return false;
498 // We've launched at least one browser. 498 // We've launched at least one browser.
499 is_process_startup = browser::startup::IS_NOT_PROCESS_STARTUP; 499 is_process_startup = chrome::startup::IS_NOT_PROCESS_STARTUP;
500 } 500 }
501 } 501 }
502 } 502 }
503 return true; 503 return true;
504 } 504 }
505 505
506 template <class AutomationProviderClass> 506 template <class AutomationProviderClass>
507 bool StartupBrowserCreator::CreateAutomationProvider( 507 bool StartupBrowserCreator::CreateAutomationProvider(
508 const std::string& channel_id, 508 const std::string& channel_id,
509 Profile* profile, 509 Profile* profile,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 NOTREACHED(); 555 NOTREACHED();
556 return; 556 return;
557 } 557 }
558 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); 558 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL);
559 } 559 }
560 560
561 bool HasPendingUncleanExit(Profile* profile) { 561 bool HasPendingUncleanExit(Profile* profile) {
562 return !profile->DidLastSessionExitCleanly() && 562 return !profile->DidLastSessionExitCleanly() &&
563 !profile_launch_observer.Get().HasBeenLaunched(profile); 563 !profile_launch_observer.Get().HasBeenLaunched(profile);
564 } 564 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator.h ('k') | chrome/browser/ui/startup/startup_browser_creator_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698