OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/download_shelf_controller.h" | 5 #import "chrome/browser/cocoa/download_shelf_controller.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/mac_util.h" | 9 #include "base/mac_util.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 91 } |
92 | 92 |
93 - (void)dealloc { | 93 - (void)dealloc { |
94 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 94 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
95 | 95 |
96 // The controllers will unregister themselves as observers when they are | 96 // The controllers will unregister themselves as observers when they are |
97 // deallocated. No need to do that here. | 97 // deallocated. No need to do that here. |
98 [super dealloc]; | 98 [super dealloc]; |
99 } | 99 } |
100 | 100 |
| 101 // Called after the current theme has changed. |
101 - (void)themeDidChangeNotification:(NSNotification*)aNotification { | 102 - (void)themeDidChangeNotification:(NSNotification*)aNotification { |
102 GTMTheme* theme = [aNotification object]; | 103 GTMTheme* theme = [aNotification object]; |
103 [self updateTheme:theme]; | 104 [self updateTheme:theme]; |
104 } | 105 } |
105 | 106 |
| 107 // Adapt appearance to the current theme. Called after theme changes and before |
| 108 // this is shown for the first time. |
106 - (void)updateTheme:(GTMTheme*)theme { | 109 - (void)updateTheme:(GTMTheme*)theme { |
107 // For the default theme, use a blue color for the link. Ideally, we'd want to | 110 // For the default theme, use a blue color for the link. Ideally, we'd want to |
108 // compare the current theme id with kDefaultThemeID, but the classic theme | 111 // compare the current theme id with kDefaultThemeID, but the classic theme |
109 // from the gallery does have a different id. Hence, we use the blue color if | 112 // from the gallery does have a different id. Hence, we use the blue color if |
110 // the current theme does not change the bookmark text color. | 113 // the current theme does not change the bookmark text color. |
111 BOOL useDefaultColor = YES; | 114 BOOL useDefaultColor = YES; |
112 if (bridge_.get() && bridge_->browser() && bridge_->browser()->profile()) { | 115 if (bridge_.get() && bridge_->browser() && bridge_->browser()->profile()) { |
113 ThemeProvider* provider = bridge_->browser()->profile()->GetThemeProvider(); | 116 ThemeProvider* provider = bridge_->browser()->profile()->GetThemeProvider(); |
114 if (provider) | 117 if (provider) |
115 useDefaultColor = provider->GetColor( | 118 useDefaultColor = provider->GetColor( |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 if (isTransferDone && | 297 if (isTransferDone && |
295 [itemController download]->safety_state() != DownloadItem::DANGEROUS) { | 298 [itemController download]->safety_state() != DownloadItem::DANGEROUS) { |
296 [self remove:itemController]; | 299 [self remove:itemController]; |
297 } else { | 300 } else { |
298 ++i; | 301 ++i; |
299 } | 302 } |
300 } | 303 } |
301 } | 304 } |
302 | 305 |
303 @end | 306 @end |
OLD | NEW |