| 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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 ServicesCustomizationDocument::GetInstance(); | 736 ServicesCustomizationDocument::GetInstance(); |
| 736 if (!ServicesCustomizationDocument::WasApplied() && | 737 if (!ServicesCustomizationDocument::WasApplied() && |
| 737 customization->IsReady()) { | 738 customization->IsReady()) { |
| 738 // Since we don't use OEM start URL anymore, just mark as applied. | 739 // Since we don't use OEM start URL anymore, just mark as applied. |
| 739 customization->ApplyCustomization(); | 740 customization->ApplyCustomization(); |
| 740 } | 741 } |
| 741 | 742 |
| 742 if (!guide_url.empty()) { | 743 if (!guide_url.empty()) { |
| 743 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kApp, | 744 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kApp, |
| 744 guide_url); | 745 guide_url); |
| 746 // These two parameters would open NTP in the background + |
| 747 // focus app window with GSG so that user won't have an empty desktop |
| 748 // after GSG is closed. |
| 749 CommandLine::ForCurrentProcess()->AppendArg(chrome::kChromeUINewTabURL); |
| 750 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 751 switches::kAppRestoreSession); |
| 745 } else { | 752 } else { |
| 746 // We should not be adding any start URLs if guide | 753 // We should not be adding any start URLs if guide |
| 747 // is defined as it launches as a standalone app window. | 754 // is defined as it launches as a standalone app window. |
| 748 for (size_t i = 0; i < start_urls.size(); ++i) | 755 for (size_t i = 0; i < start_urls.size(); ++i) |
| 749 CommandLine::ForCurrentProcess()->AppendArg(start_urls[i]); | 756 CommandLine::ForCurrentProcess()->AppendArg(start_urls[i]); |
| 750 } | 757 } |
| 751 } | 758 } |
| 752 | 759 |
| 753 #if defined(NEW_GSG_URL) | 760 #if defined(NEW_GSG_URL) |
| 754 std::string ExistingUserController::GetGettingStartedGuideURL() const { | 761 std::string ExistingUserController::GetGettingStartedGuideURL() const { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 if (!current_version.components().size()) { | 821 if (!current_version.components().size()) { |
| 815 NOTREACHED() << "Incorrect version " << current_version.GetString(); | 822 NOTREACHED() << "Incorrect version " << current_version.GetString(); |
| 816 return; | 823 return; |
| 817 } | 824 } |
| 818 | 825 |
| 819 // TODO(nkostylev): Disable this prior to M19>M20 update. | 826 // TODO(nkostylev): Disable this prior to M19>M20 update. |
| 820 // Trigger on major version change. | 827 // Trigger on major version change. |
| 821 if (current_version.components()[0] > prev_version.components()[0]) { | 828 if (current_version.components()[0] > prev_version.components()[0]) { |
| 822 std::string release_notes_url = GetGettingStartedGuideURL(); | 829 std::string release_notes_url = GetGettingStartedGuideURL(); |
| 823 if (!release_notes_url.empty()) { | 830 if (!release_notes_url.empty()) { |
| 824 // TODO(nkostylev): Ideally we'd want to show this in app window | 831 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 825 // but passing --app=<url> would ignore session restore. | 832 switches::kAppRestoreSession); |
| 826 CommandLine::ForCurrentProcess()->AppendArg(release_notes_url); | 833 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kApp, |
| 834 release_notes_url); |
| 827 prefs->SetString(prefs::kChromeOSReleaseNotesVersion, | 835 prefs->SetString(prefs::kChromeOSReleaseNotesVersion, |
| 828 current_version.GetString()); | 836 current_version.GetString()); |
| 829 } | 837 } |
| 830 } | 838 } |
| 831 } | 839 } |
| 832 | 840 |
| 833 void ExistingUserController::ShowError(int error_id, | 841 void ExistingUserController::ShowError(int error_id, |
| 834 const std::string& details) { | 842 const std::string& details) { |
| 835 // TODO(dpolukhin): show detailed error info. |details| string contains | 843 // TODO(dpolukhin): show detailed error info. |details| string contains |
| 836 // low level error info that is not localized and even is not user friendly. | 844 // low level error info that is not localized and even is not user friendly. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 865 // Invalidate OAuth token, since it can't be correct after password is | 873 // Invalidate OAuth token, since it can't be correct after password is |
| 866 // changed. | 874 // changed. |
| 867 UserManager::Get()->SaveUserOAuthStatus(username, | 875 UserManager::Get()->SaveUserOAuthStatus(username, |
| 868 User::OAUTH_TOKEN_STATUS_INVALID); | 876 User::OAUTH_TOKEN_STATUS_INVALID); |
| 869 | 877 |
| 870 login_display_->SetUIEnabled(true); | 878 login_display_->SetUIEnabled(true); |
| 871 login_display_->ShowGaiaPasswordChanged(username); | 879 login_display_->ShowGaiaPasswordChanged(username); |
| 872 } | 880 } |
| 873 | 881 |
| 874 } // namespace chromeos | 882 } // namespace chromeos |
| OLD | NEW |