Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 // Make sure that we're not loading a profile with the same ID as a profile | 168 // Make sure that we're not loading a profile with the same ID as a profile |
| 169 // that's already loaded. | 169 // that's already loaded. |
| 170 if (GetProfileByPath(profile->GetPath())) { | 170 if (GetProfileByPath(profile->GetPath())) { |
| 171 NOTREACHED() << "Attempted to add profile with the same path (" << | 171 NOTREACHED() << "Attempted to add profile with the same path (" << |
| 172 profile->GetPath().value() << | 172 profile->GetPath().value() << |
| 173 ") as an already-loaded profile."; | 173 ") as an already-loaded profile."; |
| 174 return false; | 174 return false; |
| 175 } | 175 } |
| 176 | 176 |
| 177 profiles_.insert(profiles_.end(), profile); | 177 profiles_.insert(profiles_.end(), profile); |
| 178 profile->InitRegisteredProtocolHandlers(); | |
|
tony
2011/02/07 20:51:45
Can we do this Init in the Profile() constructor?
koz (OOO until 15th September)
2011/02/13 22:33:48
Yep, done.
| |
| 178 if (init_extensions) | 179 if (init_extensions) |
| 179 profile->InitExtensions(); | 180 profile->InitExtensions(); |
| 180 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 181 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 181 if (!command_line.HasSwitch(switches::kDisableWebResources)) | 182 if (!command_line.HasSwitch(switches::kDisableWebResources)) |
| 182 profile->InitWebResources(); | 183 profile->InitWebResources(); |
| 183 return true; | 184 return true; |
| 184 } | 185 } |
| 185 | 186 |
| 186 Profile* ProfileManager::GetProfileByPath(const FilePath& path) const { | 187 Profile* ProfileManager::GetProfileByPath(const FilePath& path) const { |
| 187 for (const_iterator i(begin()); i != end(); ++i) { | 188 for (const_iterator i(begin()); i != end(); ++i) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 if (!file_util::PathExists(path)) { | 274 if (!file_util::PathExists(path)) { |
| 274 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the | 275 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the |
| 275 // profile directory. We should eventually be able to run in this | 276 // profile directory. We should eventually be able to run in this |
| 276 // situation. | 277 // situation. |
| 277 if (!file_util::CreateDirectory(path)) | 278 if (!file_util::CreateDirectory(path)) |
| 278 return NULL; | 279 return NULL; |
| 279 } | 280 } |
| 280 | 281 |
| 281 return Profile::CreateProfile(path); | 282 return Profile::CreateProfile(path); |
| 282 } | 283 } |
| OLD | NEW |