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

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

Issue 32943006: [Refactor] Replace kFullscreenUsesMinimalChromeKey with WindowState::hide_shelf_when_fullscreen() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 1 month 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 | « ash/wm/window_state.cc ('k') | chrome/browser/ui/ash/chrome_shell_delegate_browsertest.cc » ('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 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/notifications/fullscreen_notification_blocker.h" 5 #include "chrome/browser/notifications/fullscreen_notification_blocker.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/fullscreen.h" 9 #include "chrome/browser/fullscreen.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
11 11
12 #if defined(USE_ASH) 12 #if defined(USE_ASH)
13 #include "ash/root_window_controller.h" 13 #include "ash/root_window_controller.h"
14 #include "ash/shell.h" 14 #include "ash/shell.h"
15 #include "ash/system/system_notifier.h" 15 #include "ash/system/system_notifier.h"
16 #include "ash/wm/window_properties.h" 16 #include "ash/wm/window_state.h"
17 #include "ui/aura/root_window.h" 17 #include "ui/aura/root_window.h"
18 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
19 #endif 19 #endif
20 20
21 namespace { 21 namespace {
22 22
23 bool DoesFullscreenModeBlockNotifications() { 23 bool DoesFullscreenModeBlockNotifications() {
24 #if defined(USE_ASH) 24 #if defined(USE_ASH)
25 if (ash::Shell::HasInstance()) { 25 if (ash::Shell::HasInstance()) {
26 ash::internal::RootWindowController* controller = 26 ash::internal::RootWindowController* controller =
27 ash::internal::RootWindowController::ForTargetRootWindow(); 27 ash::internal::RootWindowController::ForTargetRootWindow();
28 28
29 // During shutdown |controller| can be NULL. 29 // During shutdown |controller| can be NULL.
30 if (!controller) 30 if (!controller)
31 return false; 31 return false;
32 32
33 // Block notifications if the shelf is hidden because of a fullscreen
34 // window.
33 const aura::Window* fullscreen_window = 35 const aura::Window* fullscreen_window =
34 controller->GetTopmostFullscreenWindow(); 36 controller->GetTopmostFullscreenWindow();
35 37 if (!fullscreen_window)
36 // Should appear notifications if kFullscreenUsesMinimalChromeKey is set, 38 return false;
37 // since shelf/message_center UI is visible in such situation. 39 return ash::wm::GetWindowState(fullscreen_window)->
38 return fullscreen_window && !fullscreen_window->GetProperty( 40 hide_shelf_when_fullscreen();
39 ash::internal::kFullscreenUsesMinimalChromeKey);
40 } 41 }
41 #endif 42 #endif
42 43
43 return IsFullScreenMode(); 44 return IsFullScreenMode();
44 } 45 }
45 46
46 } // namespace 47 } // namespace
47 48
48 FullscreenNotificationBlocker::FullscreenNotificationBlocker( 49 FullscreenNotificationBlocker::FullscreenNotificationBlocker(
49 message_center::MessageCenter* message_center) 50 message_center::MessageCenter* message_center)
(...skipping 27 matching lines...) Expand all
77 return enabled; 78 return enabled;
78 } 79 }
79 80
80 void FullscreenNotificationBlocker::Observe( 81 void FullscreenNotificationBlocker::Observe(
81 int type, 82 int type,
82 const content::NotificationSource& source, 83 const content::NotificationSource& source,
83 const content::NotificationDetails& details) { 84 const content::NotificationDetails& details) {
84 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); 85 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type);
85 CheckState(); 86 CheckState();
86 } 87 }
OLDNEW
« no previous file with comments | « ash/wm/window_state.cc ('k') | chrome/browser/ui/ash/chrome_shell_delegate_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698