| 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 <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <shlobj.h> | 9 #include <shlobj.h> |
| 10 | 10 |
| 11 #include <set> | 11 #include <set> |
| 12 #include <sstream> | 12 #include <sstream> |
| 13 | 13 |
| 14 #include "app/app_switches.h" | 14 #include "app/app_switches.h" |
| 15 #include "app/l10n_util.h" | 15 #include "app/l10n_util.h" |
| 16 #include "app/resource_bundle.h" | 16 #include "app/resource_bundle.h" |
| 17 #include "base/environment.h" | 17 #include "base/environment.h" |
| 18 #include "base/file_util.h" | 18 #include "base/file_util.h" |
| 19 #include "base/object_watcher.h" | 19 #include "base/object_watcher.h" |
| 20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 21 #include "base/scoped_comptr_win.h" | 21 #include "base/scoped_comptr_win.h" |
| 22 #include "base/scoped_ptr.h" | 22 #include "base/scoped_ptr.h" |
| 23 #include "base/string_number_conversions.h" | 23 #include "base/string_number_conversions.h" |
| 24 #include "base/string_split.h" | 24 #include "base/string_split.h" |
| 25 #include "base/utf_string_conversions.h" | 25 #include "base/utf_string_conversions.h" |
| 26 #include "base/win/registry.h" | 26 #include "base/win/registry.h" |
| 27 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
| 28 #include "chrome/browser/extensions/extensions_service.h" | 28 #include "chrome/browser/extensions/extension_service.h" |
| 29 #include "chrome/browser/extensions/extension_updater.h" | 29 #include "chrome/browser/extensions/extension_updater.h" |
| 30 #include "chrome/browser/importer/importer.h" | 30 #include "chrome/browser/importer/importer.h" |
| 31 #include "chrome/browser/metrics/user_metrics.h" | 31 #include "chrome/browser/metrics/user_metrics.h" |
| 32 #include "chrome/browser/process_singleton.h" | 32 #include "chrome/browser/process_singleton.h" |
| 33 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
| 34 #include "chrome/browser/search_engines/template_url_model.h" | 34 #include "chrome/browser/search_engines/template_url_model.h" |
| 35 #include "chrome/browser/views/first_run_search_engine_view.h" | 35 #include "chrome/browser/views/first_run_search_engine_view.h" |
| 36 #include "chrome/common/chrome_constants.h" | 36 #include "chrome/common/chrome_constants.h" |
| 37 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
| 38 #include "chrome/common/notification_service.h" | 38 #include "chrome/common/notification_service.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 registrar_.Add(this, NotificationType::BROWSER_CLOSED, | 144 registrar_.Add(this, NotificationType::BROWSER_CLOSED, |
| 145 NotificationService::AllSources()); | 145 NotificationService::AllSources()); |
| 146 } | 146 } |
| 147 | 147 |
| 148 virtual void Observe(NotificationType type, | 148 virtual void Observe(NotificationType type, |
| 149 const NotificationSource& source, | 149 const NotificationSource& source, |
| 150 const NotificationDetails& details) { | 150 const NotificationDetails& details) { |
| 151 // After processing the notification we always delete ourselves. | 151 // After processing the notification we always delete ourselves. |
| 152 if (type.value == NotificationType::EXTENSIONS_READY) | 152 if (type.value == NotificationType::EXTENSIONS_READY) |
| 153 DoExtensionWork(Source<Profile>(source).ptr()->GetExtensionsService()); | 153 DoExtensionWork(Source<Profile>(source).ptr()->GetExtensionService()); |
| 154 delete this; | 154 delete this; |
| 155 return; | 155 return; |
| 156 } | 156 } |
| 157 | 157 |
| 158 private: | 158 private: |
| 159 // Private ctor forces it to be created only in the heap. | 159 // Private ctor forces it to be created only in the heap. |
| 160 ~FirstRunDelayedTasks() {} | 160 ~FirstRunDelayedTasks() {} |
| 161 | 161 |
| 162 // The extension work is to basically trigger an extension update check. | 162 // The extension work is to basically trigger an extension update check. |
| 163 // If the extension specified in the master pref is older than the live | 163 // If the extension specified in the master pref is older than the live |
| 164 // extension it will get updated which is the same as get it installed. | 164 // extension it will get updated which is the same as get it installed. |
| 165 void DoExtensionWork(ExtensionsService* service) { | 165 void DoExtensionWork(ExtensionService* service) { |
| 166 if (!service) | 166 if (!service) |
| 167 return; | 167 return; |
| 168 service->updater()->CheckNow(); | 168 service->updater()->CheckNow(); |
| 169 return; | 169 return; |
| 170 } | 170 } |
| 171 | 171 |
| 172 NotificationRegistrar registrar_; | 172 NotificationRegistrar registrar_; |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 } // namespace | 175 } // namespace |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 | 855 |
| 856 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { | 856 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { |
| 857 if (version > 10000) { | 857 if (version > 10000) { |
| 858 // This is a test value. We want to make sure we exercise | 858 // This is a test value. We want to make sure we exercise |
| 859 // returning this early. See EarlyReturnTest test harness. | 859 // returning this early. See EarlyReturnTest test harness. |
| 860 return Upgrade::TD_NOT_NOW; | 860 return Upgrade::TD_NOT_NOW; |
| 861 } | 861 } |
| 862 TryChromeDialog td(version); | 862 TryChromeDialog td(version); |
| 863 return td.ShowModal(); | 863 return td.ShowModal(); |
| 864 } | 864 } |
| OLD | NEW |