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

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

Issue 11597010: Automate more Better Session Restore tests: Crashes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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/startup/startup_browser_creator.h ('k') | no next file » | 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) 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 case chrome::NOTIFICATION_PROFILE_DESTROYED: { 123 case chrome::NOTIFICATION_PROFILE_DESTROYED: {
124 Profile* profile = content::Source<Profile>(source).ptr(); 124 Profile* profile = content::Source<Profile>(source).ptr();
125 launched_profiles.erase(profile); 125 launched_profiles.erase(profile);
126 break; 126 break;
127 } 127 }
128 default: 128 default:
129 NOTREACHED(); 129 NOTREACHED();
130 } 130 }
131 } 131 }
132 132
133 bool HasBeenLaunched(const Profile* profile) { 133 bool HasBeenLaunched(const Profile* profile) const {
134 return launched_profiles.find(profile) != launched_profiles.end(); 134 return launched_profiles.find(profile) != launched_profiles.end();
135 } 135 }
136 136
137 void AddLaunched(const Profile* profile) { 137 void AddLaunched(const Profile* profile) {
138 launched_profiles.insert(profile); 138 launched_profiles.insert(profile);
139 } 139 }
140 140
141 void Clear() {
142 launched_profiles.clear();
143 }
144
141 private: 145 private:
142 std::set<const Profile*> launched_profiles; 146 std::set<const Profile*> launched_profiles;
143 content::NotificationRegistrar registrar_; 147 content::NotificationRegistrar registrar_;
144 148
145 DISALLOW_COPY_AND_ASSIGN(ProfileLaunchObserver); 149 DISALLOW_COPY_AND_ASSIGN(ProfileLaunchObserver);
146 }; 150 };
147 151
148 base::LazyInstance<ProfileLaunchObserver> profile_launch_observer = 152 base::LazyInstance<ProfileLaunchObserver> profile_launch_observer =
149 LAZY_INSTANCE_INITIALIZER; 153 LAZY_INSTANCE_INITIALIZER;
150 154
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // session which is the default for ChromeOS in general. 264 // session which is the default for ChromeOS in general.
261 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) { 265 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) {
262 DCHECK(pref.type == SessionStartupPref::LAST); 266 DCHECK(pref.type == SessionStartupPref::LAST);
263 pref.type = SessionStartupPref::DEFAULT; 267 pref.type = SessionStartupPref::DEFAULT;
264 } 268 }
265 #endif // OS_CHROMEOS 269 #endif // OS_CHROMEOS
266 270
267 return pref; 271 return pref;
268 } 272 }
269 273
274 // static
275 void StartupBrowserCreator::ClearLaunchedProfilesForTesting() {
276 profile_launch_observer.Get().Clear();
277 }
278
270 std::vector<GURL> StartupBrowserCreator::GetURLsFromCommandLine( 279 std::vector<GURL> StartupBrowserCreator::GetURLsFromCommandLine(
271 const CommandLine& command_line, 280 const CommandLine& command_line,
272 const FilePath& cur_dir, 281 const FilePath& cur_dir,
273 Profile* profile) { 282 Profile* profile) {
274 std::vector<GURL> urls; 283 std::vector<GURL> urls;
275 const CommandLine::StringVector& params = command_line.GetArgs(); 284 const CommandLine::StringVector& params = command_line.GetArgs();
276 285
277 for (size_t i = 0; i < params.size(); ++i) { 286 for (size_t i = 0; i < params.size(); ++i) {
278 FilePath param = FilePath(params[i]); 287 FilePath param = FilePath(params[i]);
279 // Handle Vista way of searching - "? <search-term>" 288 // Handle Vista way of searching - "? <search-term>"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 NOTREACHED(); 591 NOTREACHED();
583 return; 592 return;
584 } 593 }
585 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); 594 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL);
586 } 595 }
587 596
588 bool HasPendingUncleanExit(Profile* profile) { 597 bool HasPendingUncleanExit(Profile* profile) {
589 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && 598 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED &&
590 !profile_launch_observer.Get().HasBeenLaunched(profile); 599 !profile_launch_observer.Get().HasBeenLaunched(profile);
591 } 600 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698