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