| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/power/idle_action_warning_observer.h" | 5 #include "chrome/browser/chromeos/power/idle_action_warning_observer.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/power/idle_action_warning_dialog_view.h" | 7 #include "chrome/browser/chromeos/power/idle_action_warning_dialog_view.h" |
| 8 #include "chromeos/dbus/dbus_thread_manager.h" | 8 #include "chromeos/dbus/dbus_thread_manager.h" |
| 9 | 9 |
| 10 namespace chromeos { | 10 namespace chromeos { |
| 11 | 11 |
| 12 IdleActionWarningObserver::IdleActionWarningObserver() : warning_dialog_(NULL) { | 12 IdleActionWarningObserver::IdleActionWarningObserver() : warning_dialog_(NULL) { |
| 13 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); | 13 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); |
| 14 } | 14 } |
| 15 | 15 |
| 16 IdleActionWarningObserver::~IdleActionWarningObserver() { | 16 IdleActionWarningObserver::~IdleActionWarningObserver() { |
| 17 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 17 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
| 18 if (warning_dialog_) | 18 if (warning_dialog_) |
| 19 warning_dialog_->CloseDialog(); | 19 warning_dialog_->CloseDialog(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 void IdleActionWarningObserver::IdleActionImminent() { | 22 void IdleActionWarningObserver::IdleActionImminent( |
| 23 const base::TimeDelta& time_until_idle_action) { |
| 23 if (!warning_dialog_) | 24 if (!warning_dialog_) |
| 24 warning_dialog_ = new IdleActionWarningDialogView; | 25 warning_dialog_ = new IdleActionWarningDialogView; |
| 25 } | 26 } |
| 26 | 27 |
| 27 void IdleActionWarningObserver::IdleActionDeferred() { | 28 void IdleActionWarningObserver::IdleActionDeferred() { |
| 28 if (warning_dialog_) | 29 if (warning_dialog_) |
| 29 warning_dialog_->CloseDialog(); | 30 warning_dialog_->CloseDialog(); |
| 30 warning_dialog_ = NULL; | 31 warning_dialog_ = NULL; |
| 31 } | 32 } |
| 32 | 33 |
| 33 } // namespace chromeos | 34 } // namespace chromeos |
| OLD | NEW |