Skip to content

Commit

Permalink
kiosk: Fix wrong profile for cert config and diagnose.
Browse files Browse the repository at this point in the history
- 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}
  • Loading branch information
xiyuan authored and Commit bot committed Apr 17, 2015
1 parent f2c1c5e commit 2d7adc6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions chrome/browser/chromeos/login/app_launch_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
18 changes: 16 additions & 2 deletions chrome/browser/chromeos/login/screens/error_screen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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),
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 2d7adc6

Please sign in to comment.