OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/metrics/histogram.h" | 6 #include "base/metrics/histogram.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/chromeos/first_run/first_run_controller.h" | 10 #include "chrome/browser/chromeos/first_run/first_run_controller.h" |
11 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 11 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
14 #include "chrome/browser/ui/extensions/app_launch_params.h" | |
15 #include "chrome/browser/ui/extensions/application_launch.h" | 14 #include "chrome/browser/ui/extensions/application_launch.h" |
16 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/extensions/extension_constants.h" | 16 #include "chrome/common/extensions/extension_constants.h" |
18 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
19 #include "chromeos/chromeos_switches.h" | 18 #include "chromeos/chromeos_switches.h" |
20 #include "components/pref_registry/pref_registry_syncable.h" | 19 #include "components/pref_registry/pref_registry_syncable.h" |
21 #include "components/user_manager/user_manager.h" | 20 #include "components/user_manager/user_manager.h" |
22 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
24 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
25 #include "extensions/browser/extension_system.h" | 24 #include "extensions/browser/extension_system.h" |
26 #include "extensions/common/constants.h" | 25 #include "extensions/common/constants.h" |
27 | 26 |
28 namespace chromeos { | 27 namespace chromeos { |
29 namespace first_run { | 28 namespace first_run { |
30 | 29 |
31 namespace { | 30 namespace { |
32 | 31 |
33 void LaunchDialogForProfile(Profile* profile) { | 32 void LaunchDialogForProfile(Profile* profile) { |
34 ExtensionService* service = | 33 ExtensionService* service = |
35 extensions::ExtensionSystem::Get(profile)->extension_service(); | 34 extensions::ExtensionSystem::Get(profile)->extension_service(); |
36 if (!service) | 35 if (!service) |
37 return; | 36 return; |
38 | 37 |
39 const extensions::Extension* extension = | 38 const extensions::Extension* extension = |
40 service->GetExtensionById(extension_misc::kFirstRunDialogId, false); | 39 service->GetExtensionById(extension_misc::kFirstRunDialogId, false); |
41 if (!extension) | 40 if (!extension) |
42 return; | 41 return; |
43 | 42 |
44 OpenApplication( | 43 OpenApplication(AppLaunchParams( |
45 AppLaunchParams(profile, extension, extensions::LAUNCH_CONTAINER_WINDOW, | 44 profile, extension, extensions::LAUNCH_CONTAINER_WINDOW, NEW_WINDOW)); |
46 NEW_WINDOW, extensions::SOURCE_CHROME_INTERNAL)); | |
47 profile->GetPrefs()->SetBoolean(prefs::kFirstRunTutorialShown, true); | 45 profile->GetPrefs()->SetBoolean(prefs::kFirstRunTutorialShown, true); |
48 } | 46 } |
49 | 47 |
50 // Object of this class waits for session start. Then it launches or not | 48 // Object of this class waits for session start. Then it launches or not |
51 // launches first-run dialog depending on user prefs and flags. Than object | 49 // launches first-run dialog depending on user prefs and flags. Than object |
52 // deletes itself. | 50 // deletes itself. |
53 class DialogLauncher : public content::NotificationObserver { | 51 class DialogLauncher : public content::NotificationObserver { |
54 public: | 52 public: |
55 explicit DialogLauncher(Profile* profile) | 53 explicit DialogLauncher(Profile* profile) |
56 : profile_(profile) { | 54 : profile_(profile) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 user_manager::UserManager::Get()->GetActiveUser())); | 103 user_manager::UserManager::Get()->GetActiveUser())); |
106 } | 104 } |
107 | 105 |
108 void LaunchTutorial() { | 106 void LaunchTutorial() { |
109 UMA_HISTOGRAM_BOOLEAN("CrosFirstRun.TutorialLaunched", true); | 107 UMA_HISTOGRAM_BOOLEAN("CrosFirstRun.TutorialLaunched", true); |
110 FirstRunController::Start(); | 108 FirstRunController::Start(); |
111 } | 109 } |
112 | 110 |
113 } // namespace first_run | 111 } // namespace first_run |
114 } // namespace chromeos | 112 } // namespace chromeos |
OLD | NEW |