OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" |
6 | 6 |
7 #include "apps/app_shim/extension_app_shim_handler_mac.h" | 7 #include "apps/app_shim/extension_app_shim_handler_mac.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/cocoa/browser_window_utils.h" | 12 #include "chrome/browser/ui/cocoa/browser_window_utils.h" |
13 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 13 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
14 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa
.h" | 14 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa
.h" |
15 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" | 15 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" |
| 16 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "content/public/browser/native_web_keyboard_event.h" | 18 #include "content/public/browser/native_web_keyboard_event.h" |
18 #include "content/public/browser/render_widget_host_view.h" | 19 #include "content/public/browser/render_widget_host_view.h" |
19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
20 #include "content/public/browser/web_contents_view.h" | 21 #include "content/public/browser/web_contents_view.h" |
21 #include "extensions/common/extension.h" | 22 #include "extensions/common/extension.h" |
22 #include "third_party/skia/include/core/SkRegion.h" | 23 #include "third_party/skia/include/core/SkRegion.h" |
23 #include "ui/gfx/skia_util.h" | 24 #include "ui/gfx/skia_util.h" |
24 | 25 |
25 // NOTE: State Before Update. | 26 // NOTE: State Before Update. |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 // Estimate the initial bounds of the window. Once the frame insets are known, | 321 // Estimate the initial bounds of the window. Once the frame insets are known, |
321 // the window bounds and constraints can be set precisely. | 322 // the window bounds and constraints can be set precisely. |
322 NSRect cocoa_bounds = GfxToCocoaBounds( | 323 NSRect cocoa_bounds = GfxToCocoaBounds( |
323 params.GetInitialWindowBounds(gfx::Insets())); | 324 params.GetInitialWindowBounds(gfx::Insets())); |
324 window.reset([[window_class alloc] | 325 window.reset([[window_class alloc] |
325 initWithContentRect:cocoa_bounds | 326 initWithContentRect:cocoa_bounds |
326 styleMask:GetWindowStyleMask() | 327 styleMask:GetWindowStyleMask() |
327 backing:NSBackingStoreBuffered | 328 backing:NSBackingStoreBuffered |
328 defer:NO]); | 329 defer:NO]); |
329 [window setTitle:base::SysUTF8ToNSString(extension()->name())]; | 330 [window setTitle:base::SysUTF8ToNSString(extension()->name())]; |
| 331 [[window contentView] cr_setWantsLayer:YES]; |
330 | 332 |
331 if (base::mac::IsOSSnowLeopard() && | 333 if (base::mac::IsOSSnowLeopard() && |
332 [window respondsToSelector:@selector(setBottomCornerRounded:)]) | 334 [window respondsToSelector:@selector(setBottomCornerRounded:)]) |
333 [window setBottomCornerRounded:NO]; | 335 [window setBottomCornerRounded:NO]; |
334 | 336 |
335 if (params.always_on_top) | 337 if (params.always_on_top) |
336 [window setLevel:AlwaysOnTopWindowLevel()]; | 338 [window setLevel:AlwaysOnTopWindowLevel()]; |
337 InitCollectionBehavior(window); | 339 InitCollectionBehavior(window); |
338 | 340 |
339 window_controller_.reset( | 341 window_controller_.reset( |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 } | 937 } |
936 | 938 |
937 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 939 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
938 if (IsRestored(*this)) | 940 if (IsRestored(*this)) |
939 restored_bounds_ = [window() frame]; | 941 restored_bounds_ = [window() frame]; |
940 } | 942 } |
941 | 943 |
942 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { | 944 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { |
943 [window() orderOut:window_controller_]; | 945 [window() orderOut:window_controller_]; |
944 } | 946 } |
OLD | NEW |