OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/login/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "chrome/browser/net/browser_url_util.h" | 35 #include "chrome/browser/net/browser_url_util.h" |
36 #include "chrome/browser/policy/policy_service.h" | 36 #include "chrome/browser/policy/policy_service.h" |
37 #include "chrome/browser/prefs/pref_service.h" | 37 #include "chrome/browser/prefs/pref_service.h" |
38 #include "chrome/browser/prefs/session_startup_pref.h" | 38 #include "chrome/browser/prefs/session_startup_pref.h" |
39 #include "chrome/browser/profiles/profile_manager.h" | 39 #include "chrome/browser/profiles/profile_manager.h" |
40 #include "chrome/common/chrome_notification_types.h" | 40 #include "chrome/common/chrome_notification_types.h" |
41 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
42 #include "chrome/common/chrome_version_info.h" | 42 #include "chrome/common/chrome_version_info.h" |
43 #include "chrome/common/net/gaia/google_service_auth_error.h" | 43 #include "chrome/common/net/gaia/google_service_auth_error.h" |
44 #include "chrome/common/pref_names.h" | 44 #include "chrome/common/pref_names.h" |
| 45 #include "chrome/common/url_constants.h" |
45 #include "chromeos/dbus/dbus_thread_manager.h" | 46 #include "chromeos/dbus/dbus_thread_manager.h" |
46 #include "chromeos/dbus/session_manager_client.h" | 47 #include "chromeos/dbus/session_manager_client.h" |
47 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
48 #include "content/public/browser/notification_service.h" | 49 #include "content/public/browser/notification_service.h" |
49 #include "content/public/browser/notification_types.h" | 50 #include "content/public/browser/notification_types.h" |
50 #include "grit/generated_resources.h" | 51 #include "grit/generated_resources.h" |
51 #include "net/http/http_auth_cache.h" | 52 #include "net/http/http_auth_cache.h" |
52 #include "net/http/http_network_session.h" | 53 #include "net/http/http_network_session.h" |
53 #include "net/http/http_transaction_factory.h" | 54 #include "net/http/http_transaction_factory.h" |
54 #include "net/url_request/url_request_context.h" | 55 #include "net/url_request/url_request_context.h" |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 ServicesCustomizationDocument::GetInstance(); | 734 ServicesCustomizationDocument::GetInstance(); |
734 if (!ServicesCustomizationDocument::WasApplied() && | 735 if (!ServicesCustomizationDocument::WasApplied() && |
735 customization->IsReady()) { | 736 customization->IsReady()) { |
736 // Since we don't use OEM start URL anymore, just mark as applied. | 737 // Since we don't use OEM start URL anymore, just mark as applied. |
737 customization->ApplyCustomization(); | 738 customization->ApplyCustomization(); |
738 } | 739 } |
739 | 740 |
740 if (!guide_url.empty()) { | 741 if (!guide_url.empty()) { |
741 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kApp, | 742 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kApp, |
742 guide_url); | 743 guide_url); |
| 744 // NTP would open in the background, app window with GSG would be focused |
| 745 // so that user won't have an empty desktop after GSG is closed. |
| 746 CommandLine::ForCurrentProcess()->AppendArg(chrome::kChromeUINewTabURL); |
743 } else { | 747 } else { |
744 // We should not be adding any start URLs if guide | 748 // We should not be adding any start URLs if guide |
745 // is defined as it launches as a standalone app window. | 749 // is defined as it launches as a standalone app window. |
746 for (size_t i = 0; i < start_urls.size(); ++i) | 750 for (size_t i = 0; i < start_urls.size(); ++i) |
747 CommandLine::ForCurrentProcess()->AppendArg(start_urls[i]); | 751 CommandLine::ForCurrentProcess()->AppendArg(start_urls[i]); |
748 } | 752 } |
749 } | 753 } |
750 | 754 |
751 #if defined(NEW_GSG_URL) | 755 #if defined(NEW_GSG_URL) |
752 std::string ExistingUserController::GetGettingStartedGuideURL() const { | 756 std::string ExistingUserController::GetGettingStartedGuideURL() const { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 if (!current_version.components().size()) { | 816 if (!current_version.components().size()) { |
813 NOTREACHED() << "Incorrect version " << current_version.GetString(); | 817 NOTREACHED() << "Incorrect version " << current_version.GetString(); |
814 return; | 818 return; |
815 } | 819 } |
816 | 820 |
817 // TODO(nkostylev): Disable this prior to M19>M20 update. | 821 // TODO(nkostylev): Disable this prior to M19>M20 update. |
818 // Trigger on major version change. | 822 // Trigger on major version change. |
819 if (current_version.components()[0] > prev_version.components()[0]) { | 823 if (current_version.components()[0] > prev_version.components()[0]) { |
820 std::string release_notes_url = GetGettingStartedGuideURL(); | 824 std::string release_notes_url = GetGettingStartedGuideURL(); |
821 if (!release_notes_url.empty()) { | 825 if (!release_notes_url.empty()) { |
822 // TODO(nkostylev): Ideally we'd want to show this in app window | 826 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kApp, |
823 // but passing --app=<url> would ignore session restore. | 827 release_notes_url); |
824 CommandLine::ForCurrentProcess()->AppendArg(release_notes_url); | |
825 prefs->SetString(prefs::kChromeOSReleaseNotesVersion, | 828 prefs->SetString(prefs::kChromeOSReleaseNotesVersion, |
826 current_version.GetString()); | 829 current_version.GetString()); |
827 } | 830 } |
828 } | 831 } |
829 } | 832 } |
830 | 833 |
831 void ExistingUserController::ShowError(int error_id, | 834 void ExistingUserController::ShowError(int error_id, |
832 const std::string& details) { | 835 const std::string& details) { |
833 // TODO(dpolukhin): show detailed error info. |details| string contains | 836 // TODO(dpolukhin): show detailed error info. |details| string contains |
834 // low level error info that is not localized and even is not user friendly. | 837 // low level error info that is not localized and even is not user friendly. |
(...skipping 28 matching lines...) Expand all Loading... |
863 // Invalidate OAuth token, since it can't be correct after password is | 866 // Invalidate OAuth token, since it can't be correct after password is |
864 // changed. | 867 // changed. |
865 UserManager::Get()->SaveUserOAuthStatus(username, | 868 UserManager::Get()->SaveUserOAuthStatus(username, |
866 User::OAUTH_TOKEN_STATUS_INVALID); | 869 User::OAUTH_TOKEN_STATUS_INVALID); |
867 | 870 |
868 login_display_->SetUIEnabled(true); | 871 login_display_->SetUIEnabled(true); |
869 login_display_->ShowGaiaPasswordChanged(username); | 872 login_display_->ShowGaiaPasswordChanged(username); |
870 } | 873 } |
871 | 874 |
872 } // namespace chromeos | 875 } // namespace chromeos |
OLD | NEW |