OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
8 | 8 |
9 #include "app/mac/scoped_nsdisable_screen_updates.h" | 9 #include "app/mac/scoped_nsdisable_screen_updates.h" |
10 #include "app/mac/nsimage_cache.h" | 10 #include "app/mac/nsimage_cache.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "chrome/browser/ui/tabs/dock_info.h" | 56 #include "chrome/browser/ui/tabs/dock_info.h" |
57 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" | 57 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
58 #include "chrome/browser/ui/window_sizer.h" | 58 #include "chrome/browser/ui/window_sizer.h" |
59 #include "chrome/common/url_constants.h" | 59 #include "chrome/common/url_constants.h" |
60 #include "content/browser/renderer_host/render_widget_host_view.h" | 60 #include "content/browser/renderer_host/render_widget_host_view.h" |
61 #include "content/browser/tab_contents/tab_contents.h" | 61 #include "content/browser/tab_contents/tab_contents.h" |
62 #include "grit/generated_resources.h" | 62 #include "grit/generated_resources.h" |
63 #include "grit/locale_settings.h" | 63 #include "grit/locale_settings.h" |
64 #include "ui/base/l10n/l10n_util.h" | 64 #include "ui/base/l10n/l10n_util.h" |
65 #include "ui/base/l10n/l10n_util_mac.h" | 65 #include "ui/base/l10n/l10n_util_mac.h" |
| 66 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
66 | 67 |
67 | 68 |
68 // ORGANIZATION: This is a big file. It is (in principle) organized as follows | 69 // ORGANIZATION: This is a big file. It is (in principle) organized as follows |
69 // (in order): | 70 // (in order): |
70 // 1. Interfaces. Very short, one-time-use classes may include an implementation | 71 // 1. Interfaces. Very short, one-time-use classes may include an implementation |
71 // immediately after their interface. | 72 // immediately after their interface. |
72 // 2. The general implementation section, ordered as follows: | 73 // 2. The general implementation section, ordered as follows: |
73 // i. Public methods and overrides. | 74 // i. Public methods and overrides. |
74 // ii. Overrides/implementations of undocumented methods. | 75 // ii. Overrides/implementations of undocumented methods. |
75 // iii. Delegate methods for various protocols, formal and informal, to which | 76 // iii. Delegate methods for various protocols, formal and informal, to which |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 182 |
182 @end | 183 @end |
183 | 184 |
184 @implementation IncognitoImageView | 185 @implementation IncognitoImageView |
185 | 186 |
186 - (BOOL)mouseDownCanMoveWindow { | 187 - (BOOL)mouseDownCanMoveWindow { |
187 return YES; | 188 return YES; |
188 } | 189 } |
189 | 190 |
190 - (void)drawRect:(NSRect)rect { | 191 - (void)drawRect:(NSRect)rect { |
191 [NSGraphicsContext saveGraphicsState]; | 192 gfx::ScopedNSGraphicsContextSaveGState scopedGState; |
192 | 193 |
193 scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); | 194 scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); |
194 [shadow.get() setShadowColor:[NSColor colorWithCalibratedWhite:0.0 | 195 [shadow.get() setShadowColor:[NSColor colorWithCalibratedWhite:0.0 |
195 alpha:0.75]]; | 196 alpha:0.75]]; |
196 [shadow.get() setShadowOffset:NSMakeSize(0, 0)]; | 197 [shadow.get() setShadowOffset:NSMakeSize(0, 0)]; |
197 [shadow.get() setShadowBlurRadius:3.0]; | 198 [shadow.get() setShadowBlurRadius:3.0]; |
198 [shadow.get() set]; | 199 [shadow.get() set]; |
199 | 200 |
200 [image_.get() drawInRect:[self bounds] | 201 [image_.get() drawInRect:[self bounds] |
201 fromRect:NSZeroRect | 202 fromRect:NSZeroRect |
202 operation:NSCompositeSourceOver | 203 operation:NSCompositeSourceOver |
203 fraction:1.0 | 204 fraction:1.0 |
204 neverFlipped:YES]; | 205 neverFlipped:YES]; |
205 [NSGraphicsContext restoreGraphicsState]; | |
206 } | 206 } |
207 | 207 |
208 - (void)setImage:(NSImage*)image { | 208 - (void)setImage:(NSImage*)image { |
209 image_.reset([image retain]); | 209 image_.reset([image retain]); |
210 } | 210 } |
211 | 211 |
212 @end | 212 @end |
213 | 213 |
214 | 214 |
215 @implementation BrowserWindowController | 215 @implementation BrowserWindowController |
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2185 | 2185 |
2186 - (BOOL)supportsBookmarkBar { | 2186 - (BOOL)supportsBookmarkBar { |
2187 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2187 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2188 } | 2188 } |
2189 | 2189 |
2190 - (BOOL)isNormalWindow { | 2190 - (BOOL)isNormalWindow { |
2191 return browser_->type() == Browser::TYPE_NORMAL; | 2191 return browser_->type() == Browser::TYPE_NORMAL; |
2192 } | 2192 } |
2193 | 2193 |
2194 @end // @implementation BrowserWindowController(WindowType) | 2194 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |