summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-26 17:12:30 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-26 17:12:30 +0000
commite988ffd3c55d2d4369b1625ab2ed6f3b9ce38877 (patch)
tree0385b577411883b88f295a2e88e8d47926be5391
parent829c2b8eac0145e88c6bb4645750b67f8ab520d0 (diff)
downloadchromium_src-e988ffd3c55d2d4369b1625ab2ed6f3b9ce38877.zip
chromium_src-e988ffd3c55d2d4369b1625ab2ed6f3b9ce38877.tar.gz
chromium_src-e988ffd3c55d2d4369b1625ab2ed6f3b9ce38877.tar.bz2
ui/gfx: Add ToString() function to Point class.
So we don't need to override operator<< for Point class. R=sky@chromium.org Review URL: http://codereview.chromium.org/8044015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102746 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/gfx/point.cc8
-rw-r--r--ui/gfx/point.h10
-rw-r--r--ui/gfx/rect.cc2
-rw-r--r--webkit/glue/web_io_operators.cc4
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl_mac.mm4
5 files changed, 14 insertions, 14 deletions
diff --git a/ui/gfx/point.cc b/ui/gfx/point.cc
index 0dc5274..ba9ced7 100644
--- a/ui/gfx/point.cc
+++ b/ui/gfx/point.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,7 +8,7 @@
#include <windows.h>
#endif
-#include <ostream>
+#include "base/stringprintf.h"
namespace gfx {
@@ -49,8 +49,8 @@ CGPoint Point::ToCGPoint() const {
}
#endif
-std::ostream& operator<<(std::ostream& out, const gfx::Point& p) {
- return out << p.x() << "," << p.y();
+std::string Point::ToString() const {
+ return base::StringPrintf("%d,%d", x_, y_);
}
} // namespace gfx
diff --git a/ui/gfx/point.h b/ui/gfx/point.h
index a290f59..5f2a3d4 100644
--- a/ui/gfx/point.h
+++ b/ui/gfx/point.h
@@ -6,10 +6,9 @@
#define UI_GFX_POINT_H_
#pragma once
-#include "build/build_config.h"
-
-#include <iosfwd>
+#include <string>
+#include "build/build_config.h"
#include "ui/base/ui_export.h"
#if defined(OS_WIN)
@@ -91,13 +90,14 @@ class UI_EXPORT Point {
CGPoint ToCGPoint() const;
#endif
+ // Returns a string representation of point.
+ std::string ToString() const;
+
private:
int x_;
int y_;
};
-UI_EXPORT std::ostream& operator<<(std::ostream& out, const gfx::Point& p);
-
} // namespace gfx
#endif // UI_GFX_POINT_H_
diff --git a/ui/gfx/rect.cc b/ui/gfx/rect.cc
index ee557d7..60e3e9f 100644
--- a/ui/gfx/rect.cc
+++ b/ui/gfx/rect.cc
@@ -274,7 +274,7 @@ bool Rect::SharesEdgeWith(const gfx::Rect& rect) const {
}
std::ostream& operator<<(std::ostream& out, const gfx::Rect& r) {
- return out << r.origin() << " " << r.size();
+ return out << r.origin().ToString() << " " << r.size();
}
} // namespace gfx
diff --git a/webkit/glue/web_io_operators.cc b/webkit/glue/web_io_operators.cc
index c053863..b3be0df 100644
--- a/webkit/glue/web_io_operators.cc
+++ b/webkit/glue/web_io_operators.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -23,7 +23,7 @@ std::ostream& operator<<(std::ostream& out, const WebString& s) {
#endif // defined(WCHAR_T_IS_UTF32)
std::ostream& operator<<(std::ostream& out, const WebPoint& p) {
- return out << static_cast<gfx::Point>(p);
+ return out << static_cast<gfx::Point>(p).ToString();
}
std::ostream& operator<<(std::ostream& out, const WebRect& p) {
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm
index 5de0b59..835cf0a 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm
+++ b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm
@@ -513,8 +513,8 @@ bool WebPluginDelegateImpl::PlatformHandleInputEvent(
if (content_origin.x() != content_area_origin_.x() ||
content_origin.y() != content_area_origin_.y()) {
DLOG(WARNING) << "Stale plugin content area location: "
- << content_area_origin_ << " instead of "
- << content_origin;
+ << content_area_origin_.ToString() << " instead of "
+ << content_origin.ToString();
SetContentAreaOrigin(content_origin);
}