Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chrome/browser/notifications/notification_ui_manager.cc

Issue 7864022: Fixing the bug, that caused UI to hang after unsupported device was inserted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style fixes Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/idle_win.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/notifications/notification_ui_manager.h" 5 #include "chrome/browser/notifications/notification_ui_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 145 }
146 146
147 void NotificationUIManager::CheckAndShowNotifications() { 147 void NotificationUIManager::CheckAndShowNotifications() {
148 CheckUserState(); 148 CheckUserState();
149 if (is_user_active_) 149 if (is_user_active_)
150 ShowNotifications(); 150 ShowNotifications();
151 } 151 }
152 152
153 void NotificationUIManager::CheckUserState() { 153 void NotificationUIManager::CheckUserState() {
154 bool is_user_active_previously = is_user_active_; 154 bool is_user_active_previously = is_user_active_;
155 is_user_active_ = CalculateIdleStateSync(0) != IDLE_STATE_LOCKED && 155 is_user_active_ = !CheckIdleStateIsLocked() && !IsFullScreenMode();
156 !IsFullScreenMode();
157 if (is_user_active_ == is_user_active_previously) 156 if (is_user_active_ == is_user_active_previously)
158 return; 157 return;
159 158
160 if (is_user_active_) { 159 if (is_user_active_) {
161 user_state_check_timer_.Stop(); 160 user_state_check_timer_.Stop();
162 // We need to show any postponed nofications when the user becomes active 161 // We need to show any postponed nofications when the user becomes active
163 // again. 162 // again.
164 ShowNotifications(); 163 ShowNotifications();
165 } else if (!user_state_check_timer_.IsRunning()) { 164 } else if (!user_state_check_timer_.IsRunning()) {
166 // Start a timer to detect the moment at which the user becomes active. 165 // Start a timer to detect the moment at which the user becomes active.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } else if (type == chrome::NOTIFICATION_PREF_CHANGED) { 239 } else if (type == chrome::NOTIFICATION_PREF_CHANGED) {
241 std::string* name = Details<std::string>(details).ptr(); 240 std::string* name = Details<std::string>(details).ptr();
242 if (*name == prefs::kDesktopNotificationPosition) 241 if (*name == prefs::kDesktopNotificationPosition)
243 balloon_collection_->SetPositionPreference( 242 balloon_collection_->SetPositionPreference(
244 static_cast<BalloonCollection::PositionPreference>( 243 static_cast<BalloonCollection::PositionPreference>(
245 position_pref_.GetValue())); 244 position_pref_.GetValue()));
246 } else { 245 } else {
247 NOTREACHED(); 246 NOTREACHED();
248 } 247 }
249 } 248 }
OLDNEW
« no previous file with comments | « chrome/browser/idle_win.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698