| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import "chrome/browser/cocoa/browser_theme_provider_init.h" | 5 #import "chrome/browser/cocoa/browser_theme_provider_init.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 forAttribute:@"textColor" | 54 forAttribute:@"textColor" |
| 55 style:GTMThemeStyleBookmarksBarButton | 55 style:GTMThemeStyleBookmarksBarButton |
| 56 state:GTMThemeStateActiveWindow]; | 56 state:GTMThemeStateActiveWindow]; |
| 57 [theme setValue:[NSColor blackColor] | 57 [theme setValue:[NSColor blackColor] |
| 58 forAttribute:@"iconColor" | 58 forAttribute:@"iconColor" |
| 59 style:GTMThemeStyleToolBarButton | 59 style:GTMThemeStyleToolBarButton |
| 60 state:GTMThemeStateActiveWindow]; | 60 state:GTMThemeStateActiveWindow]; |
| 61 return theme; | 61 return theme; |
| 62 } | 62 } |
| 63 | 63 |
| 64 NSImage* frameImage = provider->HasCustomImage(IDR_THEME_FRAME) ? | 64 NSImage* frameImage = provider->GetNSImageNamed(IDR_THEME_FRAME, false); |
| 65 provider->GetNSImageNamed(IDR_THEME_FRAME) : nil; | |
| 66 if (frameImage) { | 65 if (frameImage) { |
| 67 NSImage* frameInactiveImage = | 66 NSImage* frameInactiveImage = |
| 68 provider->GetNSImageNamed(IDR_THEME_FRAME_INACTIVE); | 67 provider->GetNSImageNamed(IDR_THEME_FRAME_INACTIVE, true); |
| 69 [theme setValue:frameImage | 68 [theme setValue:frameImage |
| 70 forAttribute:@"backgroundImage" | 69 forAttribute:@"backgroundImage" |
| 71 style:GTMThemeStyleWindow | 70 style:GTMThemeStyleWindow |
| 72 state:GTMThemeStateActiveWindow]; | 71 state:GTMThemeStateActiveWindow]; |
| 73 [theme setValue:frameInactiveImage | 72 [theme setValue:frameInactiveImage |
| 74 forAttribute:@"backgroundImage" | 73 forAttribute:@"backgroundImage" |
| 75 style:GTMThemeStyleWindow | 74 style:GTMThemeStyleWindow |
| 76 state:0]; | 75 state:0]; |
| 77 } | 76 } |
| 78 | 77 |
| 79 NSColor* tabTextColor = | 78 NSColor* tabTextColor = |
| 80 provider->GetNSColor(BrowserThemeProvider::COLOR_TAB_TEXT); | 79 provider->GetNSColor(BrowserThemeProvider::COLOR_TAB_TEXT, false); |
| 81 [theme setValue:tabTextColor | 80 [theme setValue:tabTextColor |
| 82 forAttribute:@"textColor" | 81 forAttribute:@"textColor" |
| 83 style:GTMThemeStyleTabBarSelected | 82 style:GTMThemeStyleTabBarSelected |
| 84 state:GTMThemeStateActiveWindow]; | 83 state:GTMThemeStateActiveWindow]; |
| 85 | 84 |
| 86 NSColor* tabInactiveTextColor = | 85 NSColor* tabInactiveTextColor = |
| 87 provider->GetNSColor(BrowserThemeProvider::COLOR_BACKGROUND_TAB_TEXT); | 86 provider->GetNSColor(BrowserThemeProvider::COLOR_BACKGROUND_TAB_TEXT, |
| 87 false); |
| 88 [theme setValue:tabInactiveTextColor | 88 [theme setValue:tabInactiveTextColor |
| 89 forAttribute:@"textColor" | 89 forAttribute:@"textColor" |
| 90 style:GTMThemeStyleTabBarDeselected | 90 style:GTMThemeStyleTabBarDeselected |
| 91 state:GTMThemeStateActiveWindow]; | 91 state:GTMThemeStateActiveWindow]; |
| 92 | 92 |
| 93 NSColor* bookmarkBarTextColor = | 93 NSColor* bookmarkBarTextColor = |
| 94 provider->GetNSColor(BrowserThemeProvider::COLOR_BOOKMARK_TEXT); | 94 provider->GetNSColor(BrowserThemeProvider::COLOR_BOOKMARK_TEXT, false); |
| 95 [theme setValue:bookmarkBarTextColor | 95 [theme setValue:bookmarkBarTextColor |
| 96 forAttribute:@"textColor" | 96 forAttribute:@"textColor" |
| 97 style:GTMThemeStyleBookmarksBarButton | 97 style:GTMThemeStyleBookmarksBarButton |
| 98 state:GTMThemeStateActiveWindow]; | 98 state:GTMThemeStateActiveWindow]; |
| 99 | 99 |
| 100 | 100 |
| 101 NSImage* toolbarImage = provider->HasCustomImage(IDR_THEME_TOOLBAR) ? | 101 NSImage* toolbarImage = provider->GetNSImageNamed(IDR_THEME_TOOLBAR, false); |
| 102 provider->GetNSImageNamed(IDR_THEME_TOOLBAR) : nil; | |
| 103 [theme setValue:toolbarImage | 102 [theme setValue:toolbarImage |
| 104 forAttribute:@"backgroundImage" | 103 forAttribute:@"backgroundImage" |
| 105 style:GTMThemeStyleToolBar | 104 style:GTMThemeStyleToolBar |
| 106 state:GTMThemeStateActiveWindow]; | 105 state:GTMThemeStateActiveWindow]; |
| 107 NSImage* toolbarBackgroundImage = | 106 NSImage* toolbarBackgroundImage = |
| 108 provider->HasCustomImage(IDR_THEME_TAB_BACKGROUND) ? | 107 provider->GetNSImageNamed(IDR_THEME_TAB_BACKGROUND, false); |
| 109 provider->GetNSImageNamed(IDR_THEME_TAB_BACKGROUND) : nil; | |
| 110 [theme setValue:toolbarBackgroundImage | 108 [theme setValue:toolbarBackgroundImage |
| 111 forAttribute:@"backgroundImage" | 109 forAttribute:@"backgroundImage" |
| 112 style:GTMThemeStyleTabBarDeselected | 110 style:GTMThemeStyleTabBarDeselected |
| 113 state:GTMThemeStateActiveWindow]; | 111 state:GTMThemeStateActiveWindow]; |
| 114 | 112 |
| 115 NSImage* toolbarButtonImage = | 113 NSImage* toolbarButtonImage = |
| 116 provider->HasCustomImage(IDR_THEME_BUTTON_BACKGROUND) ? | 114 provider->GetNSImageNamed(IDR_THEME_BUTTON_BACKGROUND, false); |
| 117 provider->GetNSImageNamed(IDR_THEME_BUTTON_BACKGROUND) : nil; | |
| 118 if (toolbarButtonImage) { | 115 if (toolbarButtonImage) { |
| 119 [theme setValue:toolbarButtonImage | 116 [theme setValue:toolbarButtonImage |
| 120 forAttribute:@"backgroundImage" | 117 forAttribute:@"backgroundImage" |
| 121 style:GTMThemeStyleToolBarButton | 118 style:GTMThemeStyleToolBarButton |
| 122 state:GTMThemeStateActiveWindow]; | 119 state:GTMThemeStateActiveWindow]; |
| 123 } else { | 120 } else { |
| 124 NSColor* startColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.0]; | 121 NSColor* startColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.0]; |
| 125 NSColor* endColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.3]; | 122 NSColor* endColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.3]; |
| 126 scoped_nsobject<NSGradient> gradient([[NSGradient alloc] | 123 scoped_nsobject<NSGradient> gradient([[NSGradient alloc] |
| 127 initWithStartingColor:startColor | 124 initWithStartingColor:startColor |
| 128 endingColor:endColor]); | 125 endingColor:endColor]); |
| 129 | 126 |
| 130 [theme setValue:gradient | 127 [theme setValue:gradient |
| 131 forAttribute:@"gradient" | 128 forAttribute:@"gradient" |
| 132 style:GTMThemeStyleToolBarButton | 129 style:GTMThemeStyleToolBarButton |
| 133 state:GTMThemeStateActiveWindow]; | 130 state:GTMThemeStateActiveWindow]; |
| 134 | 131 |
| 135 [theme setValue:gradient | 132 [theme setValue:gradient |
| 136 forAttribute:@"gradient" | 133 forAttribute:@"gradient" |
| 137 style:GTMThemeStyleToolBarButton | 134 style:GTMThemeStyleToolBarButton |
| 138 state:GTMThemeStateActiveWindow]; | 135 state:GTMThemeStateActiveWindow]; |
| 139 } | 136 } |
| 140 | 137 |
| 141 NSColor* toolbarButtonIconColor = | 138 NSColor* toolbarButtonIconColor = |
| 142 provider->GetNSColorTint(BrowserThemeProvider::TINT_BUTTONS); | 139 provider->GetNSColorTint(BrowserThemeProvider::TINT_BUTTONS, false); |
| 143 [theme setValue:toolbarButtonIconColor | 140 [theme setValue:toolbarButtonIconColor |
| 144 forAttribute:@"iconColor" | 141 forAttribute:@"iconColor" |
| 145 style:GTMThemeStyleToolBarButton | 142 style:GTMThemeStyleToolBarButton |
| 146 state:GTMThemeStateActiveWindow]; | 143 state:GTMThemeStateActiveWindow]; |
| 147 | 144 |
| 148 NSColor* toolbarButtonBorderColor = toolbarButtonIconColor; | 145 NSColor* toolbarButtonBorderColor = toolbarButtonIconColor; |
| 149 [theme setValue:toolbarButtonBorderColor | 146 [theme setValue:toolbarButtonBorderColor |
| 150 forAttribute:@"borderColor" | 147 forAttribute:@"borderColor" |
| 151 style:GTMThemeStyleToolBar | 148 style:GTMThemeStyleToolBar |
| 152 state:GTMThemeStateActiveWindow]; | 149 state:GTMThemeStateActiveWindow]; |
| 153 | 150 |
| 154 NSColor* toolbarBackgroundColor = | 151 NSColor* toolbarBackgroundColor = |
| 155 provider->GetNSColor(BrowserThemeProvider::COLOR_TOOLBAR); | 152 provider->GetNSColor(BrowserThemeProvider::COLOR_TOOLBAR, false); |
| 156 [theme setValue:toolbarBackgroundColor | 153 [theme setValue:toolbarBackgroundColor |
| 157 forAttribute:@"backgroundColor" | 154 forAttribute:@"backgroundColor" |
| 158 style:GTMThemeStyleToolBar | 155 style:GTMThemeStyleToolBar |
| 159 state:GTMThemeStateActiveWindow]; | 156 state:GTMThemeStateActiveWindow]; |
| 160 | 157 |
| 161 NSImage* frameOverlayImage = | 158 NSImage* frameOverlayImage = |
| 162 provider->HasCustomImage(IDR_THEME_FRAME_OVERLAY) ? | 159 provider->GetNSImageNamed(IDR_THEME_FRAME_OVERLAY, false); |
| 163 provider->GetNSImageNamed(IDR_THEME_FRAME_OVERLAY) : nil; | |
| 164 if (frameOverlayImage) { | 160 if (frameOverlayImage) { |
| 165 [theme setValue:frameOverlayImage | 161 [theme setValue:frameOverlayImage |
| 166 forAttribute:@"overlay" | 162 forAttribute:@"overlay" |
| 167 style:GTMThemeStyleWindow | 163 style:GTMThemeStyleWindow |
| 168 state:GTMThemeStateActiveWindow]; | 164 state:GTMThemeStateActiveWindow]; |
| 169 NSImage* frameOverlayInactiveImage = | 165 NSImage* frameOverlayInactiveImage = |
| 170 provider->GetNSImageNamed(IDR_THEME_FRAME_OVERLAY_INACTIVE); | 166 provider->GetNSImageNamed(IDR_THEME_FRAME_OVERLAY_INACTIVE, true); |
| 171 if (frameOverlayInactiveImage) { | 167 if (frameOverlayInactiveImage) { |
| 172 [theme setValue:frameOverlayInactiveImage | 168 [theme setValue:frameOverlayInactiveImage |
| 173 forAttribute:@"overlay" | 169 forAttribute:@"overlay" |
| 174 style:GTMThemeStyleWindow | 170 style:GTMThemeStyleWindow |
| 175 state:GTMThemeStateInactiveWindow]; | 171 state:GTMThemeStateInactiveWindow]; |
| 176 } | 172 } |
| 177 } | 173 } |
| 178 | 174 |
| 179 return theme; | 175 return theme; |
| 180 } | 176 } |
| 181 | 177 |
| 182 | |
| 183 @end // @implementation GTMTheme(BrowserThemeProviderInitialization) | 178 @end // @implementation GTMTheme(BrowserThemeProviderInitialization) |
| OLD | NEW |