| 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 "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/chromeos/first_run/first_run_controller.h" | 8 #include "chrome/browser/chromeos/first_run/first_run_controller.h" |
| 9 #include "chrome/browser/chromeos/login/user_manager.h" | 9 #include "chrome/browser/chromeos/login/user_manager.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 virtual void Observe(int type, | 58 virtual void Observe(int type, |
| 59 const content::NotificationSource& source, | 59 const content::NotificationSource& source, |
| 60 const content::NotificationDetails& details) OVERRIDE { | 60 const content::NotificationDetails& details) OVERRIDE { |
| 61 DCHECK(type == chrome::NOTIFICATION_SESSION_STARTED); | 61 DCHECK(type == chrome::NOTIFICATION_SESSION_STARTED); |
| 62 DCHECK(content::Details<const User>(details).ptr() == | 62 DCHECK(content::Details<const User>(details).ptr() == |
| 63 UserManager::Get()->GetUserByProfile(profile_)); | 63 UserManager::Get()->GetUserByProfile(profile_)); |
| 64 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 64 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 65 bool launched_in_test = command_line->HasSwitch(::switches::kTestType); | 65 bool launched_in_test = command_line->HasSwitch(::switches::kTestType); |
| 66 bool launched_in_telemetry = | 66 bool launched_in_telemetry = |
| 67 command_line->HasSwitch(switches::kOobeSkipPostLogin); | 67 command_line->HasSwitch(switches::kOobeSkipPostLogin); |
| 68 bool first_run_disabled = | |
| 69 command_line->HasSwitch(switches::kDisableFirstRunUI); | |
| 70 bool is_user_new = chromeos::UserManager::Get()->IsCurrentUserNew(); | 68 bool is_user_new = chromeos::UserManager::Get()->IsCurrentUserNew(); |
| 71 bool first_run_forced = command_line->HasSwitch(switches::kForceFirstRunUI); | 69 bool first_run_forced = command_line->HasSwitch(switches::kForceFirstRunUI); |
| 72 bool first_run_seen = | 70 bool first_run_seen = |
| 73 profile_->GetPrefs()->GetBoolean(prefs::kFirstRunTutorialShown); | 71 profile_->GetPrefs()->GetBoolean(prefs::kFirstRunTutorialShown); |
| 74 if (!launched_in_telemetry && !first_run_disabled && | 72 if (!launched_in_telemetry && |
| 75 ((is_user_new && !first_run_seen && !launched_in_test) || | 73 ((is_user_new && !first_run_seen && !launched_in_test) || |
| 76 first_run_forced)) { | 74 first_run_forced)) { |
| 77 LaunchDialogForProfile(profile_); | 75 LaunchDialogForProfile(profile_); |
| 78 } | 76 } |
| 79 delete this; | 77 delete this; |
| 80 } | 78 } |
| 81 | 79 |
| 82 private: | 80 private: |
| 83 Profile* profile_; | 81 Profile* profile_; |
| 84 content::NotificationRegistrar registrar_; | 82 content::NotificationRegistrar registrar_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 101 user_manager->GetProfileByUser(user_manager->GetActiveUser())); | 99 user_manager->GetProfileByUser(user_manager->GetActiveUser())); |
| 102 } | 100 } |
| 103 | 101 |
| 104 void LaunchTutorial() { | 102 void LaunchTutorial() { |
| 105 UMA_HISTOGRAM_BOOLEAN("CrosFirstRun.TutorialLaunched", true); | 103 UMA_HISTOGRAM_BOOLEAN("CrosFirstRun.TutorialLaunched", true); |
| 106 FirstRunController::Start(); | 104 FirstRunController::Start(); |
| 107 } | 105 } |
| 108 | 106 |
| 109 } // namespace first_run | 107 } // namespace first_run |
| 110 } // namespace chromeos | 108 } // namespace chromeos |
| OLD | NEW |