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/mac/mac_util.h" | 6 #include "base/mac/mac_util.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 #import "chrome/browser/app_controller_mac.h" | 9 #import "chrome/browser/app_controller_mac.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // The time, in milliseconds, that a fullscreen check will be started after | 24 // The time, in milliseconds, that a fullscreen check will be started after |
25 // the active workspace change is notified. This value is from experiment. | 25 // the active workspace change is notified. This value is from experiment. |
26 const int kCheckFullScreenDelayTimeMs = 200; | 26 const int kCheckFullScreenDelayTimeMs = 200; |
27 | 27 |
28 class DisplaySettingsProviderCocoa : public DisplaySettingsProvider, | 28 class DisplaySettingsProviderCocoa : public DisplaySettingsProvider, |
29 public ui::WorkAreaWatcherObserver, | 29 public ui::WorkAreaWatcherObserver, |
30 public content::NotificationObserver { | 30 public content::NotificationObserver { |
31 public: | 31 public: |
32 DisplaySettingsProviderCocoa(); | 32 DisplaySettingsProviderCocoa(); |
33 virtual ~DisplaySettingsProviderCocoa(); | 33 ~DisplaySettingsProviderCocoa() override; |
34 | 34 |
35 void ActiveSpaceChanged(); | 35 void ActiveSpaceChanged(); |
36 | 36 |
37 protected: | 37 protected: |
38 // Overridden from DisplaySettingsProvider: | 38 // Overridden from DisplaySettingsProvider: |
39 virtual bool NeedsPeriodicFullScreenCheck() const override; | 39 bool NeedsPeriodicFullScreenCheck() const override; |
40 virtual bool IsFullScreen() override; | 40 bool IsFullScreen() override; |
41 | 41 |
42 // Overridden from ui::WorkAreaWatcherObserver: | 42 // Overridden from ui::WorkAreaWatcherObserver: |
43 virtual void WorkAreaChanged() override; | 43 void WorkAreaChanged() override; |
44 | 44 |
45 // Overridden from content::NotificationObserver: | 45 // Overridden from content::NotificationObserver: |
46 virtual void Observe(int type, | 46 void Observe(int type, |
47 const content::NotificationSource& source, | 47 const content::NotificationSource& source, |
48 const content::NotificationDetails& details) override; | 48 const content::NotificationDetails& details) override; |
49 | 49 |
50 private: | 50 private: |
51 void ActiveWorkSpaceChanged(); | 51 void ActiveWorkSpaceChanged(); |
52 | 52 |
53 content::NotificationRegistrar registrar_; | 53 content::NotificationRegistrar registrar_; |
54 id active_space_change_; | 54 id active_space_change_; |
55 | 55 |
56 // Owned by MessageLoop after posting. | 56 // Owned by MessageLoop after posting. |
57 base::WeakPtrFactory<DisplaySettingsProviderCocoa> weak_factory_; | 57 base::WeakPtrFactory<DisplaySettingsProviderCocoa> weak_factory_; |
58 | 58 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 PERFORM_FULLSCREEN_CHECK), | 144 PERFORM_FULLSCREEN_CHECK), |
145 base::TimeDelta::FromMilliseconds(kCheckFullScreenDelayTimeMs)); | 145 base::TimeDelta::FromMilliseconds(kCheckFullScreenDelayTimeMs)); |
146 } | 146 } |
147 | 147 |
148 } // namespace | 148 } // namespace |
149 | 149 |
150 // static | 150 // static |
151 DisplaySettingsProvider* DisplaySettingsProvider::Create() { | 151 DisplaySettingsProvider* DisplaySettingsProvider::Create() { |
152 return new DisplaySettingsProviderCocoa(); | 152 return new DisplaySettingsProviderCocoa(); |
153 } | 153 } |
OLD | NEW |