Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Unified Diff: trunk/src/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm

Issue 265843005: Revert 267559 "[Mac] Implement frame.[color|inactiveColor]." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
===================================================================
--- trunk/src/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm (revision 267650)
+++ trunk/src/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm (working copy)
@@ -6,7 +6,6 @@
#include "apps/app_shim/extension_app_shim_handler_mac.h"
#include "base/command_line.h"
-#include "base/mac/foundation_util.h"
#include "base/mac/mac_util.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
@@ -21,7 +20,6 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "extensions/common/extension.h"
-#include "skia/ext/skia_utils_mac.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/skia_util.h"
@@ -225,15 +223,9 @@
@implementation ShellNSWindow
@end
-@interface ShellCustomFrameNSWindow : ShellNSWindow {
- @private
- base::scoped_nsobject<NSColor> color_;
- base::scoped_nsobject<NSColor> inactiveColor_;
-}
+@interface ShellCustomFrameNSWindow : ShellNSWindow
- (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view;
-- (void)setColor:(NSColor*)color
- inactiveColor:(NSColor*)inactiveColor;
@end
@@ -251,30 +243,18 @@
[[NSBezierPath bezierPathWithRoundedRect:[view bounds]
xRadius:cornerRadius
yRadius:cornerRadius] addClip];
- if ([self isMainWindow] || [self isKeyWindow])
- [color_ set];
- else
- [inactiveColor_ set];
+ [[NSColor whiteColor] set];
NSRectFill(rect);
}
-- (void)setColor:(NSColor*)color
- inactiveColor:(NSColor*)inactiveColor {
- color_.reset([color retain]);
- inactiveColor_.reset([inactiveColor retain]);
-}
-
@end
-@interface ShellFramelessNSWindow : ShellNSWindow
-- (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view;
+@interface ShellFramelessNSWindow : ShellCustomFrameNSWindow
+
@end
@implementation ShellFramelessNSWindow
-- (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view {
-}
-
+ (NSRect)frameRectForContentRect:(NSRect)contentRect
styleMask:(NSUInteger)mask {
return contentRect;
@@ -326,17 +306,17 @@
is_resizable_(params.resizable),
shows_resize_controls_(true),
shows_fullscreen_controls_(true),
- has_frame_color_(params.has_frame_color),
- active_frame_color_(params.active_frame_color),
- inactive_frame_color_(params.inactive_frame_color),
attention_request_id_(0) {
Observe(web_contents());
base::scoped_nsobject<NSWindow> window;
Class window_class;
if (has_frame_) {
- window_class = has_frame_color_ ?
- [ShellCustomFrameNSWindow class] : [ShellNSWindow class];
+ bool should_use_native_frame =
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAppsUseNativeFrame);
+ window_class = should_use_native_frame ?
+ [ShellNSWindow class] : [ShellCustomFrameNSWindow class];
} else {
window_class = [ShellFramelessNSWindow class];
}
@@ -352,11 +332,6 @@
defer:NO]);
[window setTitle:base::SysUTF8ToNSString(extension()->name())];
[[window contentView] cr_setWantsLayer:YES];
- if (has_frame_ && has_frame_color_) {
- [base::mac::ObjCCastStrict<ShellCustomFrameNSWindow>(window)
- setColor:gfx::SkColorToSRGBNSColor(active_frame_color_)
- inactiveColor:gfx::SkColorToSRGBNSColor(inactive_frame_color_)];
- }
if (base::mac::IsOSSnowLeopard() &&
[window respondsToSelector:@selector(setBottomCornerRounded:)])
@@ -398,8 +373,11 @@
NSMiniaturizableWindowMask;
if (shows_resize_controls_)
style_mask |= NSResizableWindowMask;
- if (!has_frame_)
+ if (!has_frame_ ||
+ !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAppsUseNativeFrame)) {
style_mask |= NSTexturedBackgroundWindowMask;
+ }
return style_mask;
}
@@ -746,11 +724,13 @@
}
SkColor NativeAppWindowCocoa::ActiveFrameColor() const {
- return active_frame_color_;
+ // TODO(benwells): Implement this.
+ return SkColor();
}
SkColor NativeAppWindowCocoa::InactiveFrameColor() const {
- return inactive_frame_color_;
+ // TODO(benwells): Implement this.
+ return SkColor();
}
gfx::Insets NativeAppWindowCocoa::GetFrameInsets() const {
« no previous file with comments | « trunk/src/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h ('k') | trunk/src/chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698