This source file includes following definitions.
- DisplayFirstRunBalloon
- SetFirstRunTimeoutForTest
- FirstRunTimerIsActive
- CheckFirstRunTimer
#include "chrome/browser/notifications/message_center_notification_manager.h"
#include "chrome/common/pref_names.h"
#include "ui/message_center/message_center_tray.h"
void MessageCenterNotificationManager::DisplayFirstRunBalloon() {
DCHECK(tray_.get());
first_run_pref_.SetValue(true);
tray_->DisplayFirstRunBalloon();
}
void MessageCenterNotificationManager::SetFirstRunTimeoutForTest(
base::TimeDelta timeout) {
first_run_idle_timeout_ = timeout;
}
bool MessageCenterNotificationManager::FirstRunTimerIsActive() const {
return first_run_balloon_timer_.IsRunning();
}
void MessageCenterNotificationManager::CheckFirstRunTimer() {
DCHECK(tray_.get());
if (first_run_pref_.GetValue())
return;
if (message_center_->HasPopupNotifications() ||
message_center_->IsMessageCenterVisible() ||
0 == message_center_->NotificationCount()) {
first_run_balloon_timer_.Stop();
return;
}
if (first_run_balloon_timer_.IsRunning())
return;
first_run_balloon_timer_.Start(
FROM_HERE,
first_run_idle_timeout_,
base::Bind(&MessageCenterNotificationManager::DisplayFirstRunBalloon,
weak_factory_.GetWeakPtr()));
}