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

Unified Diff: ui/gfx/geometry/size.cc

Issue 1092033006: [Mac/Cleanup] Trim down Foundation.h and ApplicationServices.h includes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include -> import Created 5 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
« no previous file with comments | « ui/gfx/geometry/size.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/size.cc
diff --git a/ui/gfx/geometry/size.cc b/ui/gfx/geometry/size.cc
index d916ebdadd3c94b2449060a10d7b36baf673d023..03aa69660190df7f7eb10b65cdf625bd1c7df8e6 100644
--- a/ui/gfx/geometry/size.cc
+++ b/ui/gfx/geometry/size.cc
@@ -6,12 +6,29 @@
#if defined(OS_WIN)
#include <windows.h>
+#elif defined(OS_IOS)
+#include <CoreGraphics/CoreGraphics.h>
+#elif defined(OS_MACOSX)
+#include <ApplicationServices/ApplicationServices.h>
#endif
#include "base/strings/stringprintf.h"
namespace gfx {
+#if defined(OS_MACOSX)
+Size::Size(const CGSize& s)
+ : width_(s.width < 0 ? 0 : s.width),
+ height_(s.height < 0 ? 0 : s.height) {
+}
+
+Size& Size::operator=(const CGSize& s) {
+ set_width(s.width);
+ set_height(s.height);
+ return *this;
+}
+#endif
+
#if defined(OS_WIN)
SIZE Size::ToSIZE() const {
SIZE s;
@@ -19,13 +36,9 @@ SIZE Size::ToSIZE() const {
s.cy = height();
return s;
}
-#endif
-
-#if defined(OS_MACOSX)
-Size& Size::operator=(const CGSize& s) {
- set_width(s.width);
- set_height(s.height);
- return *this;
+#elif defined(OS_MACOSX)
+CGSize Size::ToCGSize() const {
+ return CGSizeMake(width(), height());
}
#endif
« no previous file with comments | « ui/gfx/geometry/size.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698