Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CONTENT_BROWSER_THEME_HELPER_MAC_H_ | 5 #ifndef CONTENT_BROWSER_THEME_HELPER_MAC_H_ |
| 6 #define CONTENT_BROWSER_THEME_HELPER_MAC_H_ | 6 #define CONTENT_BROWSER_THEME_HELPER_MAC_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
| 11 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.h" |
| 12 #include "third_party/WebKit/public/web/mac/WebScrollbarTheme.h" | 12 #include "third_party/WebKit/public/web/mac/WebScrollbarTheme.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 class CONTENT_EXPORT ScopedPreferredScrollerStyleOveride { | |
|
tapted
2016/01/31 23:33:13
ObjectiveC gives us a cheaty way to do this kind o
| |
| 17 public: | |
| 18 ScopedPreferredScrollerStyleOveride(blink::ScrollerStyle value); | |
|
tapted
2016/01/31 23:33:13
nit: explicit
| |
| 19 ~ScopedPreferredScrollerStyleOveride(); | |
| 20 | |
| 21 blink::ScrollerStyle value() const { return value_; } | |
| 22 | |
| 23 private: | |
| 24 blink::ScrollerStyle value_; | |
| 25 }; | |
|
tapted
2016/01/31 23:33:13
nit: DISALLOW_COPY_AND_ASSIGN(..)
| |
| 26 | |
| 16 class ThemeHelperMac : public NotificationObserver { | 27 class ThemeHelperMac : public NotificationObserver { |
| 17 public: | 28 public: |
| 18 // Return pointer to the singleton instance for the current process, or NULL | 29 // Return pointer to the singleton instance for the current process, or NULL |
| 19 // if none. | 30 // if none. |
| 20 static ThemeHelperMac* GetInstance(); | 31 static ThemeHelperMac* GetInstance(); |
| 21 | 32 |
| 22 // Returns the value of +[NSScroller preferredScrollStyle] as expressed | 33 // Returns the value of +[NSScroller preferredScrollStyle] as expressed |
| 23 // as the blink enum value. | 34 // as the blink enum value. |
| 24 static blink::ScrollerStyle GetPreferredScrollerStyle(); | 35 static blink::ScrollerStyle GetPreferredScrollerStyle(); |
| 25 | 36 |
| 26 private: | 37 private: |
| 27 friend struct base::DefaultSingletonTraits<ThemeHelperMac>; | 38 friend struct base::DefaultSingletonTraits<ThemeHelperMac>; |
| 28 | 39 |
| 29 ThemeHelperMac(); | 40 ThemeHelperMac(); |
| 30 ~ThemeHelperMac() override; | 41 ~ThemeHelperMac() override; |
| 31 | 42 |
| 32 // Overridden from NotificationObserver: | 43 // Overridden from NotificationObserver: |
| 33 void Observe(int type, | 44 void Observe(int type, |
| 34 const NotificationSource& source, | 45 const NotificationSource& source, |
| 35 const NotificationDetails& details) override; | 46 const NotificationDetails& details) override; |
| 36 | 47 |
| 37 NotificationRegistrar registrar_; | 48 NotificationRegistrar registrar_; |
| 38 | 49 |
| 39 DISALLOW_COPY_AND_ASSIGN(ThemeHelperMac); | 50 DISALLOW_COPY_AND_ASSIGN(ThemeHelperMac); |
| 40 }; | 51 }; |
| 41 | 52 |
| 42 } // namespace content | 53 } // namespace content |
| 43 | 54 |
| 44 #endif // CONTENT_BROWSER_THEME_HELPER_MAC_H_ | 55 #endif // CONTENT_BROWSER_THEME_HELPER_MAC_H_ |
| OLD | NEW |