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
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/power/idle_action_warning_observer.h"
7 #include "chrome/browser/chromeos/power/idle_action_warning_dialog_view.h"
8 #include "chromeos/dbus/dbus_thread_manager.h"
12 IdleActionWarningObserver::IdleActionWarningObserver() : warning_dialog_(NULL
) {
13 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
16 IdleActionWarningObserver::~IdleActionWarningObserver() {
17 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
19 warning_dialog_
->CloseDialog();
22 void IdleActionWarningObserver::IdleActionImminent() {
24 warning_dialog_
= new IdleActionWarningDialogView
;
27 void IdleActionWarningObserver::IdleActionDeferred() {
29 warning_dialog_
->CloseDialog();
30 warning_dialog_
= NULL
;
33 } // namespace chromeos