From 2d7adc6584671438c74a2fb2b4fcc14a300d6a5d Mon Sep 17 00:00:00 2001 From: xiyuan Date: Fri, 17 Apr 2015 13:31:49 -0700 Subject: [PATCH] kiosk: Fix wrong profile for cert config and diagnose. - Use app profile for cert config dialog and diagnose app; - Do not show owner auth UI when showing network config UI; BUG=472304 Review URL: https://codereview.chromium.org/1086183004 Cr-Commit-Position: refs/heads/master@{#325704} --- chrome/browser/chromeos/login/app_launch_controller.cc | 3 +++ chrome/browser/chromeos/login/screens/error_screen.cc | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/chrome/browser/chromeos/login/app_launch_controller.cc b/chrome/browser/chromeos/login/app_launch_controller.cc index 33cb6b86ea60..eb33f14a2e70 100644 --- a/chrome/browser/chromeos/login/app_launch_controller.cc +++ b/chrome/browser/chromeos/login/app_launch_controller.cc @@ -195,6 +195,9 @@ void AppLaunchController::SetNeedOwnerAuthToConfigureNetworkCallbackForTesting( void AppLaunchController::OnConfigureNetwork() { DCHECK(profile_); + if (showing_network_dialog_) + return; + showing_network_dialog_ = true; if (CanConfigureNetwork() && NeedOwnerAuthToConfigureNetwork()) { signin_screen_.reset(new AppLaunchSigninScreen( diff --git a/chrome/browser/chromeos/login/screens/error_screen.cc b/chrome/browser/chromeos/login/screens/error_screen.cc index 5958b8ee6514..89480bffa3eb 100644 --- a/chrome/browser/chromeos/login/screens/error_screen.cc +++ b/chrome/browser/chromeos/login/screens/error_screen.cc @@ -8,6 +8,7 @@ #include "base/bind_helpers.h" #include "base/command_line.h" #include "base/logging.h" +#include "chrome/browser/app_mode/app_mode_utils.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/app_mode/app_session_lifetime.h" #include "chrome/browser/chromeos/app_mode/certificate_manager_dialog.h" @@ -24,6 +25,7 @@ #include "chrome/browser/chromeos/settings/device_settings_service.h" #include "chrome/browser/extensions/component_loader.h" #include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/extensions/app_launch_params.h" #include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/common/extensions/extension_constants.h" @@ -41,6 +43,18 @@ namespace chromeos { +namespace { + +// Returns the current running kiosk app profile in a kiosk session. Otherwise, +// returns nullptr. +Profile* GetAppProfile() { + return chrome::IsRunningInForcedAppMode() + ? ProfileManager::GetActiveUserProfile() + : nullptr; +} + +} // namespace + ErrorScreen::ErrorScreen(BaseScreenDelegate* base_screen_delegate, NetworkErrorView* view) : NetworkErrorModel(base_screen_delegate), @@ -250,12 +264,12 @@ void ErrorScreen::OnConfigureCerts() { gfx::NativeWindow native_window = LoginDisplayHostImpl::default_host()->GetNativeWindow(); CertificateManagerDialog* dialog = new CertificateManagerDialog( - ProfileHelper::GetSigninProfile(), NULL, native_window); + GetAppProfile(), NULL, native_window); dialog->Show(); } void ErrorScreen::OnDiagnoseButtonClicked() { - Profile* profile = ProfileHelper::GetSigninProfile(); + Profile* profile = GetAppProfile(); ExtensionService* extension_service = extensions::ExtensionSystem::Get(profile)->extension_service(); -- 2.11.4.GIT