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

Unified Diff: chrome/browser/ui/panels/panel_window_controller_cocoa.mm

Issue 10815077: mac: Let panels get its resize cursors from WebKit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: avi Created 8 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/panel_window_controller_cocoa.mm
diff --git a/chrome/browser/ui/panels/panel_window_controller_cocoa.mm b/chrome/browser/ui/panels/panel_window_controller_cocoa.mm
index c5dad1a9cf0d51294148fa22b2ce98960acd597f..8c77b8f680316a373a21b37218aebadfec4d3775 100644
--- a/chrome/browser/ui/panels/panel_window_controller_cocoa.mm
+++ b/chrome/browser/ui/panels/panel_window_controller_cocoa.mm
@@ -36,11 +36,12 @@
#include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
#include "grit/ui_resources.h"
#include "skia/ext/skia_utils_mac.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image.h"
-#include "ui/gfx/mac/nsimage_cache.h"
+#include "webkit/glue/webcursor.h"
using content::WebContents;
@@ -127,30 +128,27 @@ const double kDragThreshold = 3.0;
}
@end
+namespace {
+NSCursor* LoadWebKitCursor(WebKit::WebCursorInfo::Type type) {
+ return WebCursor(WebKit::WebCursorInfo(type)).GetNativeCursor();
+}
+}
+
@implementation PanelResizeByMouseOverlay
- (PanelResizeByMouseOverlay*)initWithFrame:(NSRect)frame panel:(Panel*)panel {
if ((self = [super initWithFrame:frame])) {
panel_ = panel;
- // Initialize resize cursors, they are very likely to be needed so it's
- // better to pre-init them then stutter the mouse later when it hovers over
- // a resize edge. We use WebKit cursors that look similar to what OSX Lion
- // uses. NSCursor class does not yet have support for those new cursors.
- NSImage* image = gfx::GetCachedImageWithName(@"eastWestResizeCursor.png");
- DCHECK(image);
+
eastWestCursor_.reset(
- [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(8,8)]);
- image = gfx::GetCachedImageWithName(@"northSouthResizeCursor.png");
- DCHECK(image);
+ [LoadWebKitCursor(WebKit::WebCursorInfo::TypeEastWestResize) retain]);
northSouthCursor_.reset(
- [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(8,8)]);
- image = gfx::GetCachedImageWithName(@"northEastSouthWestResizeCursor.png");
- DCHECK(image);
+ [LoadWebKitCursor(WebKit::WebCursorInfo::TypeNorthSouthResize) retain]);
northEastSouthWestCursor_.reset(
- [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(8,8)]);
- image = gfx::GetCachedImageWithName(@"northWestSouthEastResizeCursor.png");
- DCHECK(image);
+ [LoadWebKitCursor(WebKit::WebCursorInfo::TypeNorthEastSouthWestResize)
+ retain]);
northWestSouthEastCursor_.reset(
- [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(8,8)]);
+ [LoadWebKitCursor(WebKit::WebCursorInfo::TypeNorthWestSouthEastResize)
+ retain]);
}
return self;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698