OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" |
9 #import "chrome/browser/app_controller_mac.h" | 10 #import "chrome/browser/app_controller_mac.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/fullscreen.h" | 12 #include "chrome/browser/fullscreen.h" |
12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" | 15 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" |
15 #include "chrome/browser/ui/panels/display_settings_provider.h" | 16 #include "chrome/browser/ui/panels/display_settings_provider.h" |
16 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
18 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // Since the fullscreen result is already known here, we can pass it dierctly | 126 // Since the fullscreen result is already known here, we can pass it dierctly |
126 // to CheckFullScreenMode. | 127 // to CheckFullScreenMode. |
127 bool is_fullscreen = *(content::Details<bool>(details)).ptr(); | 128 bool is_fullscreen = *(content::Details<bool>(details)).ptr(); |
128 CheckFullScreenMode( | 129 CheckFullScreenMode( |
129 is_fullscreen ? ASSUME_FULLSCREEN_ON : ASSUME_FULLSCREEN_OFF); | 130 is_fullscreen ? ASSUME_FULLSCREEN_ON : ASSUME_FULLSCREEN_OFF); |
130 } | 131 } |
131 | 132 |
132 void DisplaySettingsProviderCocoa::ActiveWorkSpaceChanged() { | 133 void DisplaySettingsProviderCocoa::ActiveWorkSpaceChanged() { |
133 // The active workspace notification might be received earlier than the | 134 // The active workspace notification might be received earlier than the |
134 // browser window knows that it is not in active space. | 135 // browser window knows that it is not in active space. |
135 base::MessageLoop::current()->PostDelayedTask( | 136 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
136 FROM_HERE, | 137 FROM_HERE, |
137 base::Bind(&DisplaySettingsProviderCocoa::CheckFullScreenMode, | 138 base::Bind(&DisplaySettingsProviderCocoa::CheckFullScreenMode, |
138 weak_factory_.GetWeakPtr(), | 139 weak_factory_.GetWeakPtr(), PERFORM_FULLSCREEN_CHECK), |
139 PERFORM_FULLSCREEN_CHECK), | |
140 base::TimeDelta::FromMilliseconds(kCheckFullScreenDelayTimeMs)); | 140 base::TimeDelta::FromMilliseconds(kCheckFullScreenDelayTimeMs)); |
141 } | 141 } |
142 | 142 |
143 } // namespace | 143 } // namespace |
144 | 144 |
145 // static | 145 // static |
146 DisplaySettingsProvider* DisplaySettingsProvider::Create() { | 146 DisplaySettingsProvider* DisplaySettingsProvider::Create() { |
147 return new DisplaySettingsProviderCocoa(); | 147 return new DisplaySettingsProviderCocoa(); |
148 } | 148 } |
OLD | NEW |