| 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 #include "content/browser/theme_helper_mac.h" | 5 #include "content/browser/theme_helper_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 object:nil | 118 object:nil |
| 119 suspensionBehavior: | 119 suspensionBehavior: |
| 120 NSNotificationSuspensionBehaviorDeliverImmediately]; | 120 NSNotificationSuspensionBehaviorDeliverImmediately]; |
| 121 | 121 |
| 122 // In single-process mode, renderers will catch these notifications | 122 // In single-process mode, renderers will catch these notifications |
| 123 // themselves and listening for them here may trigger the DCHECK in Observe(). | 123 // themselves and listening for them here may trigger the DCHECK in Observe(). |
| 124 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 124 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 125 switches::kSingleProcess)) { | 125 switches::kSingleProcess)) { |
| 126 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 126 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 127 | 127 |
| 128 if ([NSScroller respondsToSelector:@selector(preferredScrollerStyle)]) { | 128 [center addObserver:self |
| 129 [center addObserver:self | 129 selector:@selector(behaviorPrefsChanged:) |
| 130 selector:@selector(behaviorPrefsChanged:) | 130 name:NSPreferredScrollerStyleDidChangeNotification |
| 131 name:NSPreferredScrollerStyleDidChangeNotification | 131 object:nil]; |
| 132 object:nil]; | |
| 133 } | |
| 134 | 132 |
| 135 [center addObserver:self | 133 [center addObserver:self |
| 136 selector:@selector(systemColorsChanged:) | 134 selector:@selector(systemColorsChanged:) |
| 137 name:NSSystemColorsDidChangeNotification | 135 name:NSSystemColorsDidChangeNotification |
| 138 object:nil]; | 136 object:nil]; |
| 139 } | 137 } |
| 140 } | 138 } |
| 141 | 139 |
| 142 + (void)appearancePrefsChanged:(NSNotification*)notification { | 140 + (void)appearancePrefsChanged:(NSNotification*)notification { |
| 143 [self notifyPrefsChangedWithRedraw:YES]; | 141 [self notifyPrefsChangedWithRedraw:YES]; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 namespace content { | 173 namespace content { |
| 176 | 174 |
| 177 // static | 175 // static |
| 178 ThemeHelperMac* ThemeHelperMac::GetInstance() { | 176 ThemeHelperMac* ThemeHelperMac::GetInstance() { |
| 179 return base::Singleton<ThemeHelperMac, | 177 return base::Singleton<ThemeHelperMac, |
| 180 base::LeakySingletonTraits<ThemeHelperMac>>::get(); | 178 base::LeakySingletonTraits<ThemeHelperMac>>::get(); |
| 181 } | 179 } |
| 182 | 180 |
| 183 // static | 181 // static |
| 184 blink::ScrollerStyle ThemeHelperMac::GetPreferredScrollerStyle() { | 182 blink::ScrollerStyle ThemeHelperMac::GetPreferredScrollerStyle() { |
| 185 if (![NSScroller respondsToSelector:@selector(preferredScrollerStyle)]) | |
| 186 return blink::ScrollerStyleLegacy; | |
| 187 return static_cast<blink::ScrollerStyle>([NSScroller preferredScrollerStyle]); | 183 return static_cast<blink::ScrollerStyle>([NSScroller preferredScrollerStyle]); |
| 188 } | 184 } |
| 189 | 185 |
| 190 ThemeHelperMac::ThemeHelperMac() { | 186 ThemeHelperMac::ThemeHelperMac() { |
| 191 [ScrollbarPrefsObserver registerAsObserver]; | 187 [ScrollbarPrefsObserver registerAsObserver]; |
| 192 registrar_.Add(this, | 188 registrar_.Add(this, |
| 193 NOTIFICATION_RENDERER_PROCESS_CREATED, | 189 NOTIFICATION_RENDERER_PROCESS_CREATED, |
| 194 NotificationService::AllSources()); | 190 NotificationService::AllSources()); |
| 195 } | 191 } |
| 196 | 192 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 209 params.redraw = false; | 205 params.redraw = false; |
| 210 | 206 |
| 211 RenderProcessHostImpl* rphi = | 207 RenderProcessHostImpl* rphi = |
| 212 Source<content::RenderProcessHostImpl>(source).ptr(); | 208 Source<content::RenderProcessHostImpl>(source).ptr(); |
| 213 rphi->RecomputeAndUpdateWebKitPreferences(); | 209 rphi->RecomputeAndUpdateWebKitPreferences(); |
| 214 rphi->Send(new ViewMsg_UpdateScrollbarTheme(params)); | 210 rphi->Send(new ViewMsg_UpdateScrollbarTheme(params)); |
| 215 rphi->Send(CreateSystemColorsChangedMessage()); | 211 rphi->Send(CreateSystemColorsChangedMessage()); |
| 216 } | 212 } |
| 217 | 213 |
| 218 } // namespace content | 214 } // namespace content |
| OLD | NEW |