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/download/download_shelf_controller.h" | 5 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
11 #include "chrome/browser/download/download_stats.h" | 11 #include "chrome/browser/download/download_stats.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/themes/theme_service.h" | 13 #include "chrome/browser/themes/theme_service.h" |
14 #include "chrome/browser/themes/theme_service_factory.h" | 14 #include "chrome/browser/themes/theme_service_factory.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/chrome_pages.h" | 16 #include "chrome/browser/ui/chrome_pages.h" |
17 #import "chrome/browser/ui/cocoa/animatable_view.h" | 17 #import "chrome/browser/ui/cocoa/animatable_view.h" |
18 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 18 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
19 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 19 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
20 #include "chrome/browser/ui/cocoa/download/download_item_controller.h" | 20 #include "chrome/browser/ui/cocoa/download/download_item_controller.h" |
21 #include "chrome/browser/ui/cocoa/download/download_shelf_mac.h" | 21 #include "chrome/browser/ui/cocoa/download/download_shelf_mac.h" |
22 #import "chrome/browser/ui/cocoa/download/download_shelf_view_cocoa.h" | 22 #import "chrome/browser/ui/cocoa/download/download_shelf_view_cocoa.h" |
23 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" | |
24 #include "content/public/browser/download_item.h" | 23 #include "content/public/browser/download_item.h" |
25 #include "content/public/browser/download_manager.h" | 24 #include "content/public/browser/download_manager.h" |
26 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" | 25 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" |
27 #import "ui/base/cocoa/hover_button.h" | 26 #import "ui/base/cocoa/hover_button.h" |
28 | 27 |
29 using content::DownloadItem; | 28 using content::DownloadItem; |
30 | 29 |
31 // Download shelf autoclose behavior: | 30 // Download shelf autoclose behavior: |
32 // | 31 // |
33 // The download shelf autocloses if all of this is true: | 32 // The download shelf autocloses if all of this is true: |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 DCHECK(hoverCloseButton_); | 122 DCHECK(hoverCloseButton_); |
124 | 123 |
125 NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter]; | 124 NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter]; |
126 [[self animatableView] setResizeDelegate:resizeDelegate_]; | 125 [[self animatableView] setResizeDelegate:resizeDelegate_]; |
127 [[self view] setPostsFrameChangedNotifications:YES]; | 126 [[self view] setPostsFrameChangedNotifications:YES]; |
128 [defaultCenter addObserver:self | 127 [defaultCenter addObserver:self |
129 selector:@selector(viewFrameDidChange:) | 128 selector:@selector(viewFrameDidChange:) |
130 name:NSViewFrameDidChangeNotification | 129 name:NSViewFrameDidChangeNotification |
131 object:[self view]]; | 130 object:[self view]]; |
132 | 131 |
133 // These notifications are declared in fullscreen_controller, and are posted | |
134 // without objects. | |
135 [defaultCenter addObserver:self | 132 [defaultCenter addObserver:self |
136 selector:@selector(willEnterFullscreen) | 133 selector:@selector(willEnterFullscreen) |
137 name:kWillEnterFullscreenNotification | 134 name:NSWindowWillEnterFullScreenNotification |
138 object:nil]; | 135 object:nil]; |
139 [defaultCenter addObserver:self | 136 [defaultCenter addObserver:self |
140 selector:@selector(willLeaveFullscreen) | 137 selector:@selector(willLeaveFullscreen) |
141 name:kWillLeaveFullscreenNotification | 138 name:NSWindowWillExitFullScreenNotification |
142 object:nil]; | 139 object:nil]; |
143 [self installTrackingArea]; | 140 [self installTrackingArea]; |
144 } | 141 } |
145 | 142 |
146 - (void)dealloc { | 143 - (void)dealloc { |
147 [self browserWillBeDestroyed]; | 144 [self browserWillBeDestroyed]; |
148 [super dealloc]; | 145 [super dealloc]; |
149 } | 146 } |
150 | 147 |
151 - (void)browserWillBeDestroyed { | 148 - (void)browserWillBeDestroyed { |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 } | 503 } |
507 | 504 |
508 // Set the tracking off to create a new tracking area for the control. | 505 // Set the tracking off to create a new tracking area for the control. |
509 // When changing the bounds/frame on a HoverButton, the tracking isn't updated | 506 // When changing the bounds/frame on a HoverButton, the tracking isn't updated |
510 // correctly, it needs to be turned off and back on. | 507 // correctly, it needs to be turned off and back on. |
511 [hoverCloseButton_ setTrackingEnabled:NO]; | 508 [hoverCloseButton_ setTrackingEnabled:NO]; |
512 [hoverCloseButton_ setFrame:bounds]; | 509 [hoverCloseButton_ setFrame:bounds]; |
513 [hoverCloseButton_ setTrackingEnabled:YES]; | 510 [hoverCloseButton_ setTrackingEnabled:YES]; |
514 } | 511 } |
515 @end | 512 @end |
OLD | NEW |