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/dock_icon.h" | 5 #import "chrome/browser/ui/cocoa/dock_icon.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
9 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
10 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
11 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 13 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
12 | 14 |
13 using content::BrowserThread; | 15 using content::BrowserThread; |
14 | 16 |
15 namespace { | 17 namespace { |
16 | 18 |
17 // The fraction of the size of the dock icon that the badge is. | 19 // The fraction of the size of the dock icon that the badge is. |
18 const float kBadgeFraction = 0.4f; | 20 const float kBadgeFraction = 0.4f; |
19 | 21 |
20 // The indentation of the badge. | 22 // The indentation of the badge. |
21 const float kBadgeIndent = 5.0f; | 23 const float kBadgeIndent = 5.0f; |
22 | 24 |
23 // The maximum update rate for the dock icon. 200ms = 5fps. | 25 // The maximum update rate for the dock icon. 200ms = 5fps. |
24 const int64 kUpdateFrequencyMs = 200; | 26 const int64_t kUpdateFrequencyMs = 200; |
25 | 27 |
26 } // namespace | 28 } // namespace |
27 | 29 |
28 // A view that draws our dock tile. | 30 // A view that draws our dock tile. |
29 @interface DockTileView : NSView { | 31 @interface DockTileView : NSView { |
30 @private | 32 @private |
31 int downloads_; | 33 int downloads_; |
32 BOOL indeterminate_; | 34 BOOL indeterminate_; |
33 float progress_; | 35 float progress_; |
34 } | 36 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 261 |
260 - (void)setProgress:(float)progress { | 262 - (void)setProgress:(float)progress { |
261 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 263 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
262 NSDockTile* dockTile = [[NSApplication sharedApplication] dockTile]; | 264 NSDockTile* dockTile = [[NSApplication sharedApplication] dockTile]; |
263 DockTileView* dockTileView = (DockTileView*)([dockTile contentView]); | 265 DockTileView* dockTileView = (DockTileView*)([dockTile contentView]); |
264 | 266 |
265 [dockTileView setProgress:progress]; | 267 [dockTileView setProgress:progress]; |
266 } | 268 } |
267 | 269 |
268 @end | 270 @end |
OLD | NEW |