OLD | NEW |
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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 LOG(ERROR) << "Can't create " << default_profile.MaybeAsASCII(); | 34 LOG(ERROR) << "Can't create " << default_profile.MaybeAsASCII(); |
35 return false; | 35 return false; |
36 } | 36 } |
37 base::FilePath non_global_pref_file = GetPreferencesFilePath(); | 37 base::FilePath non_global_pref_file = GetPreferencesFilePath(); |
38 if (!file_util::PathExists(non_global_pref_file)) { | 38 if (!file_util::PathExists(non_global_pref_file)) { |
39 LOG(ERROR) << "Doesn't exist " << non_global_pref_file.MaybeAsASCII(); | 39 LOG(ERROR) << "Doesn't exist " << non_global_pref_file.MaybeAsASCII(); |
40 return false; | 40 return false; |
41 } | 41 } |
42 base::FilePath default_pref_file = | 42 base::FilePath default_pref_file = |
43 default_profile.Append(chrome::kPreferencesFilename); | 43 default_profile.Append(chrome::kPreferencesFilename); |
44 if (!file_util::CopyFile(non_global_pref_file, default_pref_file)) { | 44 if (!base::CopyFile(non_global_pref_file, default_pref_file)) { |
45 LOG(ERROR) << "Copy error from " << non_global_pref_file.MaybeAsASCII() | 45 LOG(ERROR) << "Copy error from " << non_global_pref_file.MaybeAsASCII() |
46 << " to " << default_pref_file.MaybeAsASCII(); | 46 << " to " << default_pref_file.MaybeAsASCII(); |
47 return false; | 47 return false; |
48 } | 48 } |
49 | 49 |
50 #if defined(OS_WIN) | 50 #if defined(OS_WIN) |
51 // Make the copy writable. On POSIX we assume the umask allows files | 51 // Make the copy writable. On POSIX we assume the umask allows files |
52 // we create to be writable. | 52 // we create to be writable. |
53 if (!::SetFileAttributesW(default_pref_file.value().c_str(), | 53 if (!::SetFileAttributesW(default_pref_file.value().c_str(), |
54 FILE_ATTRIBUTE_NORMAL)) return false; | 54 FILE_ATTRIBUTE_NORMAL)) return false; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // So it doesn't need to be tested here. | 179 // So it doesn't need to be tested here. |
180 EXPECT_EQ("FixedFontFamily", | 180 EXPECT_EQ("FixedFontFamily", |
181 prefs->GetString(prefs::kWebKitFixedFontFamily)); | 181 prefs->GetString(prefs::kWebKitFixedFontFamily)); |
182 EXPECT_EQ("SansSerifFontFamily", | 182 EXPECT_EQ("SansSerifFontFamily", |
183 prefs->GetString(prefs::kWebKitSansSerifFontFamily)); | 183 prefs->GetString(prefs::kWebKitSansSerifFontFamily)); |
184 EXPECT_EQ("SerifFontFamily", | 184 EXPECT_EQ("SerifFontFamily", |
185 prefs->GetString(prefs::kWebKitSerifFontFamily)); | 185 prefs->GetString(prefs::kWebKitSerifFontFamily)); |
186 EXPECT_EQ("StandardFontFamily", | 186 EXPECT_EQ("StandardFontFamily", |
187 prefs->GetString(prefs::kWebKitStandardFontFamily)); | 187 prefs->GetString(prefs::kWebKitStandardFontFamily)); |
188 }; | 188 }; |
OLD | NEW |