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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 #import <QuartzCore/QuartzCore.h> | 6 #import <QuartzCore/QuartzCore.h> |
7 | 7 |
8 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" | 8 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/prefs/pref_registry_simple.h" | 13 #include "base/prefs/pref_registry_simple.h" |
14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
18 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
19 #include "chrome/browser/ui/cocoa/confirm_quit.h" | 19 #include "chrome/browser/ui/cocoa/confirm_quit.h" |
20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
21 #include "chrome/grit/generated_resources.h" | 21 #include "chrome/grit/generated_resources.h" |
22 #import "ui/base/accelerators/platform_accelerator_cocoa.h" | 22 #import "ui/base/accelerators/platform_accelerator_cocoa.h" |
23 #include "ui/base/l10n/l10n_util_mac.h" | 23 #include "ui/base/l10n/l10n_util_mac.h" |
24 | 24 |
25 // Constants /////////////////////////////////////////////////////////////////// | 25 // Constants /////////////////////////////////////////////////////////////////// |
26 | 26 |
27 // How long the user must hold down Cmd+Q to confirm the quit. | 27 // How long the user must hold down Cmd+Q to confirm the quit. |
28 const NSTimeInterval kTimeToConfirmQuit = 1.5; | 28 const NSTimeInterval kTimeToConfirmQuit = 1.5; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 if ((self = [super initWithDuration:duration | 148 if ((self = [super initWithDuration:duration |
149 animationCurve:NSAnimationLinear])) { | 149 animationCurve:NSAnimationLinear])) { |
150 application_ = app; | 150 application_ = app; |
151 [self setDelegate:self]; | 151 [self setDelegate:self]; |
152 } | 152 } |
153 return self; | 153 return self; |
154 } | 154 } |
155 | 155 |
156 - (void)setCurrentProgress:(NSAnimationProgress)progress { | 156 - (void)setCurrentProgress:(NSAnimationProgress)progress { |
157 for (NSWindow* window in [application_ windows]) { | 157 for (NSWindow* window in [application_ windows]) { |
158 if ([[window windowController] | 158 if (chrome::FindBrowserWithWindow(window)) |
159 isKindOfClass:[BrowserWindowController class]]) { | |
160 [window setAlphaValue:1.0 - progress]; | 159 [window setAlphaValue:1.0 - progress]; |
161 } | |
162 } | 160 } |
163 } | 161 } |
164 | 162 |
165 - (void)animationDidStop:(NSAnimation*)anim { | 163 - (void)animationDidStop:(NSAnimation*)anim { |
166 DCHECK_EQ(self, anim); | 164 DCHECK_EQ(self, anim); |
167 [self autorelease]; | 165 [self autorelease]; |
168 } | 166 } |
169 | 167 |
170 @end | 168 @end |
171 | 169 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 if (modifiers & NSAlternateKeyMask) | 417 if (modifiers & NSAlternateKeyMask) |
420 [string appendString:@"\u2325"]; | 418 [string appendString:@"\u2325"]; |
421 if (modifiers & NSShiftKeyMask) | 419 if (modifiers & NSShiftKeyMask) |
422 [string appendString:@"\u21E7"]; | 420 [string appendString:@"\u21E7"]; |
423 | 421 |
424 [string appendString:[item.characters() uppercaseString]]; | 422 [string appendString:[item.characters() uppercaseString]]; |
425 return string; | 423 return string; |
426 } | 424 } |
427 | 425 |
428 @end | 426 @end |
OLD | NEW |