OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/profile.h" | 5 #include "chrome/browser/profile.h" |
6 | 6 |
7 #include "app/theme_provider.h" | 7 #include "app/theme_provider.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 // TODO(akalin): Come up with unit tests for this. | 601 // TODO(akalin): Come up with unit tests for this. |
602 // TODO(akalin): Use for Linux, too? | 602 // TODO(akalin): Use for Linux, too? |
603 if (!HasACacheSubdir(path_)) { | 603 if (!HasACacheSubdir(path_)) { |
604 FilePath app_data_path, user_cache_path; | 604 FilePath app_data_path, user_cache_path; |
605 if (PathService::Get(base::DIR_APP_DATA, &app_data_path) && | 605 if (PathService::Get(base::DIR_APP_DATA, &app_data_path) && |
606 PathService::Get(base::DIR_CACHE, &user_cache_path) && | 606 PathService::Get(base::DIR_CACHE, &user_cache_path) && |
607 app_data_path.AppendRelativePath(path_, &user_cache_path)) { | 607 app_data_path.AppendRelativePath(path_, &user_cache_path)) { |
608 base_cache_path_ = user_cache_path; | 608 base_cache_path_ = user_cache_path; |
609 } | 609 } |
610 } | 610 } |
| 611 #elif defined(OS_POSIX) // Posix minus Mac. |
| 612 // See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html |
| 613 // for a spec on where cache files go. The net effect for most systems is we |
| 614 // use ~/.cache/chromium/ for Chromium and ~/.cache/google-chrome/ for |
| 615 // official builds. |
| 616 if (!PathService::IsOverridden(chrome::DIR_USER_DATA)) { |
| 617 #if defined(GOOGLE_CHROME_BUILD) |
| 618 const char kCacheDir[] = "google-chrome"; |
611 #else | 619 #else |
612 if (!PathService::IsOverridden(chrome::DIR_USER_DATA)) | 620 const char kCacheDir[] = "chromium"; |
613 PathService::Get(chrome::DIR_USER_CACHE, &base_cache_path_); | 621 #endif |
| 622 PathService::Get(base::DIR_USER_CACHE, &base_cache_path_); |
| 623 base_cache_path_ = base_cache_path_.Append(kCacheDir); |
| 624 if (!file_util::PathExists(base_cache_path_)) |
| 625 file_util::CreateDirectory(base_cache_path_); |
| 626 } |
614 #endif | 627 #endif |
615 if (base_cache_path_.empty()) | 628 if (base_cache_path_.empty()) |
616 base_cache_path_ = path_; | 629 base_cache_path_ = path_; |
617 | 630 |
618 // Listen for theme installation. | 631 // Listen for theme installation. |
619 registrar_.Add(this, NotificationType::THEME_INSTALLED, | 632 registrar_.Add(this, NotificationType::THEME_INSTALLED, |
620 NotificationService::AllSources()); | 633 NotificationService::AllSources()); |
621 | 634 |
622 // Listen for bookmark model load, to bootstrap the sync service. | 635 // Listen for bookmark model load, to bootstrap the sync service. |
623 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, | 636 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 } | 1303 } |
1291 if (!sync_service_.get()) | 1304 if (!sync_service_.get()) |
1292 InitSyncService(); | 1305 InitSyncService(); |
1293 return sync_service_.get(); | 1306 return sync_service_.get(); |
1294 } | 1307 } |
1295 | 1308 |
1296 void ProfileImpl::InitSyncService() { | 1309 void ProfileImpl::InitSyncService() { |
1297 sync_service_.reset(new ProfileSyncService(this)); | 1310 sync_service_.reset(new ProfileSyncService(this)); |
1298 sync_service_->Initialize(); | 1311 sync_service_->Initialize(); |
1299 } | 1312 } |
OLD | NEW |