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 "chrome/browser/first_run/first_run.h" | 5 #include "chrome/browser/first_run/first_run.h" |
6 | 6 |
7 #include "app/app_switches.h" | 7 #include "app/app_switches.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
| 12 #include "base/string_piece.h" |
12 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/utf_string_conversions.h" |
13 #include "base/values.h" | 15 #include "base/values.h" |
14 #include "chrome/browser/gtk/first_run_dialog.h" | 16 #include "chrome/browser/gtk/first_run_dialog.h" |
15 #include "chrome/browser/profile_manager.h" | 17 #include "chrome/browser/profile_manager.h" |
16 #include "chrome/browser/shell_integration.h" | 18 #include "chrome/browser/shell_integration.h" |
17 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
19 #include "chrome/common/result_codes.h" | 21 #include "chrome/common/result_codes.h" |
20 #include "chrome/installer/util/google_update_settings.h" | 22 #include "chrome/installer/util/google_update_settings.h" |
21 #include "chrome/installer/util/master_preferences.h" | 23 #include "chrome/installer/util/master_preferences.h" |
22 #include "chrome/installer/util/util_constants.h" | 24 #include "chrome/installer/util/util_constants.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 installer_util::master_preferences::kDistroShowWelcomePage, &value) && | 98 installer_util::master_preferences::kDistroShowWelcomePage, &value) && |
97 value) | 99 value) |
98 FirstRun::SetShowWelcomePagePref(); | 100 FirstRun::SetShowWelcomePagePref(); |
99 | 101 |
100 // We need to be able to create the first run sentinel or else we cannot | 102 // We need to be able to create the first run sentinel or else we cannot |
101 // proceed because ImportSettings will launch the importer process which | 103 // proceed because ImportSettings will launch the importer process which |
102 // would end up here if the sentinel is not present. | 104 // would end up here if the sentinel is not present. |
103 if (!FirstRun::CreateSentinel()) | 105 if (!FirstRun::CreateSentinel()) |
104 return false; | 106 return false; |
105 | 107 |
106 std::wstring import_bookmarks_path; | 108 std::string import_bookmarks_path; |
107 installer_util::GetDistroStringPreference(prefs.get(), | 109 installer_util::GetDistroStringPreference(prefs.get(), |
108 installer_util::master_preferences::kDistroImportBookmarksFromFilePref, | 110 installer_util::master_preferences::kDistroImportBookmarksFromFilePref, |
109 &import_bookmarks_path); | 111 &import_bookmarks_path); |
110 | 112 |
111 if (!import_bookmarks_path.empty()) { | 113 if (!import_bookmarks_path.empty()) { |
112 // There are bookmarks to import from a file. | 114 // There are bookmarks to import from a file. |
113 FilePath path = FilePath::FromWStringHack(import_bookmarks_path); | 115 FilePath path = FilePath::FromWStringHack( |
| 116 UTF8ToWide(import_bookmarks_path)); |
114 if (!FirstRun::ImportBookmarks(path)) { | 117 if (!FirstRun::ImportBookmarks(path)) { |
115 LOG(WARNING) << "silent bookmark import failed"; | 118 LOG(WARNING) << "silent bookmark import failed"; |
116 } | 119 } |
117 } | 120 } |
118 return false; | 121 return false; |
119 } | 122 } |
120 | 123 |
121 // TODO(port): This is just a piece of the silent import functionality from | 124 // TODO(port): This is just a piece of the silent import functionality from |
122 // ImportSettings for Windows. It would be nice to get the rest of it ported. | 125 // ImportSettings for Windows. It would be nice to get the rest of it ported. |
123 bool FirstRun::ImportBookmarks(const FilePath& import_bookmarks_path) { | 126 bool FirstRun::ImportBookmarks(const FilePath& import_bookmarks_path) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 174 } |
172 file_util::FileInfo exe_file_info; | 175 file_util::FileInfo exe_file_info; |
173 if (!file_util::GetFileInfo(exe_file_path, &exe_file_info)) { | 176 if (!file_util::GetFileInfo(exe_file_path, &exe_file_info)) { |
174 LOG(WARNING) << "Failed to get FileInfo object for FILE_EXE - " | 177 LOG(WARNING) << "Failed to get FileInfo object for FILE_EXE - " |
175 << exe_file_path.value(); | 178 << exe_file_path.value(); |
176 return saved_last_modified_time_of_exe_; | 179 return saved_last_modified_time_of_exe_; |
177 } | 180 } |
178 return exe_file_info.last_modified.ToDoubleT(); | 181 return exe_file_info.last_modified.ToDoubleT(); |
179 } | 182 } |
180 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) | 183 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) |
OLD | NEW |