| 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 "chrome/browser/first_run/first_run.h" | 5 #include "chrome/browser/first_run/first_run.h" |
| 6 | 6 |
| 7 #include <shlobj.h> | 7 #include <shlobj.h> |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "chrome/installer/util/master_preferences_constants.h" | 41 #include "chrome/installer/util/master_preferences_constants.h" |
| 42 #include "chrome/installer/util/shell_util.h" | 42 #include "chrome/installer/util/shell_util.h" |
| 43 #include "chrome/installer/util/util_constants.h" | 43 #include "chrome/installer/util/util_constants.h" |
| 44 #include "content/public/browser/notification_service.h" | 44 #include "content/public/browser/notification_service.h" |
| 45 #include "content/public/browser/user_metrics.h" | 45 #include "content/public/browser/user_metrics.h" |
| 46 #include "google_update/google_update_idl.h" | 46 #include "google_update/google_update_idl.h" |
| 47 #include "grit/chromium_strings.h" | 47 #include "grit/chromium_strings.h" |
| 48 #include "grit/generated_resources.h" | 48 #include "grit/generated_resources.h" |
| 49 #include "grit/locale_settings.h" | 49 #include "grit/locale_settings.h" |
| 50 #include "grit/theme_resources.h" | 50 #include "grit/theme_resources.h" |
| 51 #include "ui/base/layout.h" |
| 51 #include "ui/base/resource/resource_bundle.h" | 52 #include "ui/base/resource/resource_bundle.h" |
| 52 #include "ui/base/ui_base_switches.h" | 53 #include "ui/base/ui_base_switches.h" |
| 53 | 54 |
| 54 namespace { | 55 namespace { |
| 55 | 56 |
| 56 // Helper class that performs delayed first-run tasks that need more of the | 57 // Helper class that performs delayed first-run tasks that need more of the |
| 57 // chrome infrastructure to be up and running before they can be attempted. | 58 // chrome infrastructure to be up and running before they can be attempted. |
| 58 class FirstRunDelayedTasks : public content::NotificationObserver { | 59 class FirstRunDelayedTasks : public content::NotificationObserver { |
| 59 public: | 60 public: |
| 60 enum Tasks { | 61 enum Tasks { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 DWORD wr = ::WaitForSingleObject(ph, INFINITE); | 168 DWORD wr = ::WaitForSingleObject(ph, INFINITE); |
| 168 if (wr != WAIT_OBJECT_0) | 169 if (wr != WAIT_OBJECT_0) |
| 169 return false; | 170 return false; |
| 170 return (TRUE == ::GetExitCodeProcess(ph, reinterpret_cast<DWORD*>(ret_code))); | 171 return (TRUE == ::GetExitCodeProcess(ph, reinterpret_cast<DWORD*>(ret_code))); |
| 171 } | 172 } |
| 172 | 173 |
| 173 // Writes the EULA to a temporary file, returned in |*eula_path|, and returns | 174 // Writes the EULA to a temporary file, returned in |*eula_path|, and returns |
| 174 // true if successful. | 175 // true if successful. |
| 175 bool WriteEULAtoTempFile(FilePath* eula_path) { | 176 bool WriteEULAtoTempFile(FilePath* eula_path) { |
| 176 base::StringPiece terms = | 177 base::StringPiece terms = |
| 177 ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_TERMS_HTML); | 178 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 179 IDR_TERMS_HTML, ui::SCALE_FACTOR_NONE); |
| 178 if (terms.empty()) | 180 if (terms.empty()) |
| 179 return false; | 181 return false; |
| 180 FILE *file = file_util::CreateAndOpenTemporaryFile(eula_path); | 182 FILE *file = file_util::CreateAndOpenTemporaryFile(eula_path); |
| 181 if (!file) | 183 if (!file) |
| 182 return false; | 184 return false; |
| 183 bool good = fwrite(terms.data(), terms.size(), 1, file) == 1; | 185 bool good = fwrite(terms.data(), terms.size(), 1, file) == 1; |
| 184 fclose(file); | 186 fclose(file); |
| 185 return good; | 187 return good; |
| 186 } | 188 } |
| 187 | 189 |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 return false; | 586 return false; |
| 585 | 587 |
| 586 internal::SetShowWelcomePagePrefIfNeeded(install_prefs.get()); | 588 internal::SetShowWelcomePagePrefIfNeeded(install_prefs.get()); |
| 587 internal::SetImportPreferencesAndLaunchImport(out_prefs, install_prefs.get()); | 589 internal::SetImportPreferencesAndLaunchImport(out_prefs, install_prefs.get()); |
| 588 internal::SetDefaultBrowser(install_prefs.get()); | 590 internal::SetDefaultBrowser(install_prefs.get()); |
| 589 | 591 |
| 590 return false; | 592 return false; |
| 591 } | 593 } |
| 592 | 594 |
| 593 } // namespace first_run | 595 } // namespace first_run |
| OLD | NEW |