OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <set> | 10 #include <set> |
11 #include <sstream> | 11 #include <sstream> |
12 | 12 |
13 #include "base/environment.h" | 13 #include "base/environment.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
17 #include "base/string_split.h" | 17 #include "base/string_split.h" |
18 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "base/win/object_watcher.h" | 20 #include "base/win/object_watcher.h" |
21 #include "base/win/windows_version.h" | 21 #include "base/win/windows_version.h" |
22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/extensions/extension_service.h" | 23 #include "chrome/browser/extensions/extension_service.h" |
24 #include "chrome/browser/extensions/extension_updater.h" | 24 #include "chrome/browser/extensions/extension_updater.h" |
25 #include "chrome/browser/first_run/first_run_import_observer.h" | 25 #include "chrome/browser/first_run/first_run_import_observer.h" |
26 #include "chrome/browser/importer/importer_host.h" | 26 #include "chrome/browser/importer/importer_host.h" |
27 #include "chrome/browser/importer/importer_list.h" | 27 #include "chrome/browser/importer/importer_list.h" |
28 #include "chrome/browser/importer/importer_progress_dialog.h" | 28 #include "chrome/browser/importer/importer_progress_dialog.h" |
29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/common/chrome_notification_types.h" |
30 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/common/worker_thread_ticker.h" | 32 #include "chrome/common/worker_thread_ticker.h" |
32 #include "chrome/installer/util/browser_distribution.h" | 33 #include "chrome/installer/util/browser_distribution.h" |
33 #include "chrome/installer/util/google_update_constants.h" | 34 #include "chrome/installer/util/google_update_constants.h" |
34 #include "chrome/installer/util/google_update_settings.h" | 35 #include "chrome/installer/util/google_update_settings.h" |
35 #include "chrome/installer/util/install_util.h" | 36 #include "chrome/installer/util/install_util.h" |
36 #include "chrome/installer/util/shell_util.h" | 37 #include "chrome/installer/util/shell_util.h" |
37 #include "chrome/installer/util/util_constants.h" | 38 #include "chrome/installer/util/util_constants.h" |
38 #include "content/browser/user_metrics.h" | 39 #include "content/browser/user_metrics.h" |
39 #include "content/common/notification_service.h" | 40 #include "content/common/notification_service.h" |
(...skipping 12 matching lines...) Expand all Loading... |
52 // chrome infrastructure to be up and running before they can be attempted. | 53 // chrome infrastructure to be up and running before they can be attempted. |
53 class FirstRunDelayedTasks : public NotificationObserver { | 54 class FirstRunDelayedTasks : public NotificationObserver { |
54 public: | 55 public: |
55 enum Tasks { | 56 enum Tasks { |
56 NO_TASK, | 57 NO_TASK, |
57 INSTALL_EXTENSIONS | 58 INSTALL_EXTENSIONS |
58 }; | 59 }; |
59 | 60 |
60 explicit FirstRunDelayedTasks(Tasks task) { | 61 explicit FirstRunDelayedTasks(Tasks task) { |
61 if (task == INSTALL_EXTENSIONS) { | 62 if (task == INSTALL_EXTENSIONS) { |
62 registrar_.Add(this, NotificationType::EXTENSIONS_READY, | 63 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, |
63 NotificationService::AllSources()); | 64 NotificationService::AllSources()); |
64 } | 65 } |
65 registrar_.Add(this, NotificationType::BROWSER_CLOSED, | 66 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, |
66 NotificationService::AllSources()); | 67 NotificationService::AllSources()); |
67 } | 68 } |
68 | 69 |
69 virtual void Observe(NotificationType type, | 70 virtual void Observe(int type, |
70 const NotificationSource& source, | 71 const NotificationSource& source, |
71 const NotificationDetails& details) { | 72 const NotificationDetails& details) { |
72 // After processing the notification we always delete ourselves. | 73 // After processing the notification we always delete ourselves. |
73 if (type.value == NotificationType::EXTENSIONS_READY) | 74 if (type == chrome::NOTIFICATION_EXTENSIONS_READY) |
74 DoExtensionWork(Source<Profile>(source).ptr()->GetExtensionService()); | 75 DoExtensionWork(Source<Profile>(source).ptr()->GetExtensionService()); |
75 delete this; | 76 delete this; |
76 return; | 77 return; |
77 } | 78 } |
78 | 79 |
79 private: | 80 private: |
80 // Private ctor forces it to be created only in the heap. | 81 // Private ctor forces it to be created only in the heap. |
81 ~FirstRunDelayedTasks() {} | 82 ~FirstRunDelayedTasks() {} |
82 | 83 |
83 // The extension work is to basically trigger an extension update check. | 84 // The extension work is to basically trigger an extension update check. |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 parent_window, | 403 parent_window, |
403 static_cast<uint16>(items_to_import), | 404 static_cast<uint16>(items_to_import), |
404 importer_host, | 405 importer_host, |
405 &importer_observer, | 406 &importer_observer, |
406 importer_list->GetSourceProfileForImporterType(importer_type), | 407 importer_list->GetSourceProfileForImporterType(importer_type), |
407 profile, | 408 profile, |
408 true); | 409 true); |
409 importer_observer.RunLoop(); | 410 importer_observer.RunLoop(); |
410 return importer_observer.import_result(); | 411 return importer_observer.import_result(); |
411 } | 412 } |
OLD | NEW |