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 #import "chrome/browser/ui/cocoa/toolbar/reload_button_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/reload_button_cocoa.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| 11 #include "chrome/app/vector_icons/vector_icons.h" |
11 #include "chrome/browser/command_updater.h" | 12 #include "chrome/browser/command_updater.h" |
12 #import "chrome/browser/ui/cocoa/accelerators_cocoa.h" | 13 #import "chrome/browser/ui/cocoa/accelerators_cocoa.h" |
13 #import "chrome/browser/ui/cocoa/themed_window.h" | 14 #import "chrome/browser/ui/cocoa/themed_window.h" |
14 #import "chrome/browser/ui/cocoa/view_id_util.h" | 15 #import "chrome/browser/ui/cocoa/view_id_util.h" |
15 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
16 #include "chrome/grit/theme_resources.h" | 17 #include "chrome/grit/theme_resources.h" |
17 #include "ui/base/accelerators/platform_accelerator_cocoa.h" | 18 #include "ui/base/accelerators/platform_accelerator_cocoa.h" |
18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/base/l10n/l10n_util_mac.h" | 20 #include "ui/base/l10n/l10n_util_mac.h" |
20 #include "ui/base/material_design/material_design_controller.h" | 21 #include "ui/base/material_design/material_design_controller.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 187 } |
187 } | 188 } |
188 | 189 |
189 return [super sendAction:theAction to:theTarget]; | 190 return [super sendAction:theAction to:theTarget]; |
190 } | 191 } |
191 | 192 |
192 - (ViewID)viewID { | 193 - (ViewID)viewID { |
193 return VIEW_ID_RELOAD_BUTTON; | 194 return VIEW_ID_RELOAD_BUTTON; |
194 } | 195 } |
195 | 196 |
196 - (gfx::VectorIconId)vectorIconId { | 197 - (const gfx::VectorIcon*)vectorIcon { |
197 if ([self tag] == IDC_RELOAD) { | 198 if ([self tag] == IDC_RELOAD) { |
198 return gfx::VectorIconId::NAVIGATE_RELOAD; | 199 return &kNavigateReloadIcon; |
199 } else if ([self tag] == IDC_STOP) { | 200 } else if ([self tag] == IDC_STOP) { |
200 return gfx::VectorIconId::NAVIGATE_STOP; | 201 return &kNavigateStopIcon; |
201 } else { | 202 } else { |
202 NOTREACHED(); | 203 NOTREACHED(); |
203 } | 204 } |
204 | 205 |
205 return gfx::VectorIconId::VECTOR_ICON_NONE; | 206 return nullptr; |
206 } | 207 } |
207 | 208 |
208 - (void)mouseInsideStateDidChange:(BOOL)isInside { | 209 - (void)mouseInsideStateDidChange:(BOOL)isInside { |
209 [pendingReloadTimer_ fire]; | 210 [pendingReloadTimer_ fire]; |
210 } | 211 } |
211 | 212 |
212 - (void)populateMenu { | 213 - (void)populateMenu { |
213 [menu_ setAutoenablesItems:NO]; | 214 [menu_ setAutoenablesItems:NO]; |
214 // 0-th item must be blank. (This is because we use a pulldown list, for which | 215 // 0-th item must be blank. (This is because we use a pulldown list, for which |
215 // Cocoa uses the 0-th item as "title" in the button.) | 216 // Cocoa uses the 0-th item as "title" in the button.) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 258 |
258 @end // ReloadButton | 259 @end // ReloadButton |
259 | 260 |
260 @implementation ReloadButton (Testing) | 261 @implementation ReloadButton (Testing) |
261 | 262 |
262 + (void)setPendingReloadTimeout:(NSTimeInterval)seconds { | 263 + (void)setPendingReloadTimeout:(NSTimeInterval)seconds { |
263 kPendingReloadTimeout = seconds; | 264 kPendingReloadTimeout = seconds; |
264 } | 265 } |
265 | 266 |
266 @end | 267 @end |
OLD | NEW |