summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-13 22:21:08 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-13 22:21:08 +0000
commitc97d12626e9273d595c6e75d20f70f536de86ee1 (patch)
treef43efa0bd7c14c0ce1eae88a5ea558adeaa9a104
parentd959de93dd9e4be04231a86d8c5b19f2038b988a (diff)
downloadchromium_src-c97d12626e9273d595c6e75d20f70f536de86ee1.zip
chromium_src-c97d12626e9273d595c6e75d20f70f536de86ee1.tar.gz
chromium_src-c97d12626e9273d595c6e75d20f70f536de86ee1.tar.bz2
content: Make GetViewBounds() return a rect rather than using an out param.
NOTE: This was a TODO for @ben. BUG=98716 R=jam@chromium.org TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/10534106 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141995 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/find_bar_host.cc3
-rw-r--r--content/browser/web_contents/web_contents_view_android.cc3
-rw-r--r--content/browser/web_contents/web_contents_view_android.h2
-rw-r--r--content/browser/web_contents/web_contents_view_aura.cc4
-rw-r--r--content/browser/web_contents/web_contents_view_aura.h2
-rw-r--r--content/browser/web_contents/web_contents_view_gtk.cc10
-rw-r--r--content/browser/web_contents/web_contents_view_gtk.h2
-rw-r--r--content/browser/web_contents/web_contents_view_mac.h2
-rw-r--r--content/browser/web_contents/web_contents_view_mac.mm5
-rw-r--r--content/browser/web_contents/web_contents_view_win.cc4
-rw-r--r--content/browser/web_contents/web_contents_view_win.h2
-rw-r--r--content/public/browser/web_contents_view.h8
-rw-r--r--content/test/test_web_contents_view.cc3
-rw-r--r--content/test/test_web_contents_view.h2
14 files changed, 27 insertions, 25 deletions
diff --git a/chrome/browser/ui/views/find_bar_host.cc b/chrome/browser/ui/views/find_bar_host.cc
index aefb407c..7e6810e 100644
--- a/chrome/browser/ui/views/find_bar_host.cc
+++ b/chrome/browser/ui/views/find_bar_host.cc
@@ -334,8 +334,7 @@ void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) {
gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowScreenBounds();
content::WebContentsView* tab_view =
find_bar_controller_->tab_contents()->web_contents()->GetView();
- gfx::Rect webcontents_rect;
- tab_view->GetViewBounds(&webcontents_rect);
+ gfx::Rect webcontents_rect = tab_view->GetViewBounds();
avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y());
}
diff --git a/content/browser/web_contents/web_contents_view_android.cc b/content/browser/web_contents/web_contents_view_android.cc
index 547d189..bec2252 100644
--- a/content/browser/web_contents/web_contents_view_android.cc
+++ b/content/browser/web_contents/web_contents_view_android.cc
@@ -112,8 +112,9 @@ void WebContentsViewAndroid::CloseTabAfterEventTracking() {
NOTIMPLEMENTED();
}
-void WebContentsViewAndroid::GetViewBounds(gfx::Rect* out) const {
+gfx::Rect WebContentsViewAndroid::GetViewBounds() const {
NOTIMPLEMENTED();
+ return gfx::Rect();
}
void WebContentsViewAndroid::ShowContextMenu(
diff --git a/content/browser/web_contents/web_contents_view_android.h b/content/browser/web_contents/web_contents_view_android.h
index 5340ffe..0352be9 100644
--- a/content/browser/web_contents/web_contents_view_android.h
+++ b/content/browser/web_contents/web_contents_view_android.h
@@ -44,7 +44,7 @@ class WebContentsViewAndroid
virtual WebDropData* GetDropData() const OVERRIDE;
virtual bool IsEventTracking() const OVERRIDE;
virtual void CloseTabAfterEventTracking() OVERRIDE;
- virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE;
+ virtual gfx::Rect GetViewBounds() const OVERRIDE;
// Backend implementation of RenderViewHostDelegateView.
virtual void ShowContextMenu(
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index 1b029ea..101e58b 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -392,8 +392,8 @@ bool WebContentsViewAura::IsEventTracking() const {
void WebContentsViewAura::CloseTabAfterEventTracking() {
}
-void WebContentsViewAura::GetViewBounds(gfx::Rect* out) const {
- *out = window_->GetBoundsInRootWindow();
+gfx::Rect WebContentsViewAura::GetViewBounds() const {
+ return window_->GetBoundsInRootWindow();
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/content/browser/web_contents/web_contents_view_aura.h b/content/browser/web_contents/web_contents_view_aura.h
index ef54036..7bb140f1 100644
--- a/content/browser/web_contents/web_contents_view_aura.h
+++ b/content/browser/web_contents/web_contents_view_aura.h
@@ -63,7 +63,7 @@ class CONTENT_EXPORT WebContentsViewAura
virtual WebDropData* GetDropData() const OVERRIDE;
virtual bool IsEventTracking() const OVERRIDE;
virtual void CloseTabAfterEventTracking() OVERRIDE;
- virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE;
+ virtual gfx::Rect GetViewBounds() const OVERRIDE;
// Overridden from RenderViewHostDelegateView:
virtual void ShowContextMenu(
diff --git a/content/browser/web_contents/web_contents_view_gtk.cc b/content/browser/web_contents/web_contents_view_gtk.cc
index 4f2b0ce..a35c87b 100644
--- a/content/browser/web_contents/web_contents_view_gtk.cc
+++ b/content/browser/web_contents/web_contents_view_gtk.cc
@@ -259,15 +259,17 @@ bool WebContentsViewGtk::IsEventTracking() const {
void WebContentsViewGtk::CloseTabAfterEventTracking() {
}
-void WebContentsViewGtk::GetViewBounds(gfx::Rect* out) const {
+gfx::Rect WebContentsViewGtk::GetViewBounds() const {
+ gfx::Rect rect;
GdkWindow* window = gtk_widget_get_window(GetNativeView());
if (!window) {
- out->SetRect(0, 0, requested_size_.width(), requested_size_.height());
- return;
+ rect.SetRect(0, 0, requested_size_.width(), requested_size_.height());
+ return rect;
}
int x = 0, y = 0, w, h;
gdk_window_get_geometry(window, &x, &y, &w, &h, NULL);
- out->SetRect(x, y, w, h);
+ rect.SetRect(x, y, w, h);
+ return rect;
}
WebContents* WebContentsViewGtk::web_contents() {
diff --git a/content/browser/web_contents/web_contents_view_gtk.h b/content/browser/web_contents/web_contents_view_gtk.h
index 0654ab7..3255c9b 100644
--- a/content/browser/web_contents/web_contents_view_gtk.h
+++ b/content/browser/web_contents/web_contents_view_gtk.h
@@ -68,7 +68,7 @@ class CONTENT_EXPORT WebContentsViewGtk
virtual WebDropData* GetDropData() const OVERRIDE;
virtual bool IsEventTracking() const OVERRIDE;
virtual void CloseTabAfterEventTracking() OVERRIDE;
- virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE;
+ virtual gfx::Rect GetViewBounds() const OVERRIDE;
// Backend implementation of RenderViewHostDelegateView.
virtual void ShowContextMenu(
diff --git a/content/browser/web_contents/web_contents_view_mac.h b/content/browser/web_contents/web_contents_view_mac.h
index 5e59db3..15e173f 100644
--- a/content/browser/web_contents/web_contents_view_mac.h
+++ b/content/browser/web_contents/web_contents_view_mac.h
@@ -81,7 +81,7 @@ class WebContentsViewMac
virtual WebDropData* GetDropData() const OVERRIDE;
virtual bool IsEventTracking() const OVERRIDE;
virtual void CloseTabAfterEventTracking() OVERRIDE;
- virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE;
+ virtual gfx::Rect GetViewBounds() const OVERRIDE;
// Backend implementation of RenderViewHostDelegateView.
virtual void ShowContextMenu(
diff --git a/content/browser/web_contents/web_contents_view_mac.mm b/content/browser/web_contents/web_contents_view_mac.mm
index 22a9271..3c0f0b8 100644
--- a/content/browser/web_contents/web_contents_view_mac.mm
+++ b/content/browser/web_contents/web_contents_view_mac.mm
@@ -22,8 +22,8 @@
#include "content/public/browser/web_contents_view_delegate.h"
#include "skia/ext/skia_utils_mac.h"
#import "third_party/mozilla/NSPasteboard+Utils.h"
-#import "ui/base/cocoa/focus_tracker.h"
#include "ui/base/clipboard/custom_data_helper.h"
+#import "ui/base/cocoa/focus_tracker.h"
#include "ui/base/dragdrop/cocoa_dnd_util.h"
using WebKit::WebDragOperation;
@@ -320,9 +320,10 @@ void WebContentsViewMac::CloseTabAfterEventTracking() {
afterDelay:0.0];
}
-void WebContentsViewMac::GetViewBounds(gfx::Rect* out) const {
+gfx::Rect WebContentsViewMac::GetViewBounds() const {
// This method is not currently used on mac.
NOTIMPLEMENTED();
+ return gfx::Rect();
}
void WebContentsViewMac::CloseTab() {
diff --git a/content/browser/web_contents/web_contents_view_win.cc b/content/browser/web_contents/web_contents_view_win.cc
index 92eff7e..3d7a9a8 100644
--- a/content/browser/web_contents/web_contents_view_win.cc
+++ b/content/browser/web_contents/web_contents_view_win.cc
@@ -233,10 +233,10 @@ bool WebContentsViewWin::IsEventTracking() const {
void WebContentsViewWin::CloseTabAfterEventTracking() {
}
-void WebContentsViewWin::GetViewBounds(gfx::Rect* out) const {
+gfx::Rect WebContentsViewWin::GetViewBounds() const {
RECT r;
GetWindowRect(hwnd(), &r);
- *out = gfx::Rect(r);
+ return gfx::Rect(r);
}
void WebContentsViewWin::ShowContextMenu(
diff --git a/content/browser/web_contents/web_contents_view_win.h b/content/browser/web_contents/web_contents_view_win.h
index 87504ac..016e359 100644
--- a/content/browser/web_contents/web_contents_view_win.h
+++ b/content/browser/web_contents/web_contents_view_win.h
@@ -72,7 +72,7 @@ class CONTENT_EXPORT WebContentsViewWin
virtual WebDropData* GetDropData() const OVERRIDE;
virtual bool IsEventTracking() const OVERRIDE;
virtual void CloseTabAfterEventTracking() OVERRIDE;
- virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE;
+ virtual gfx::Rect GetViewBounds() const OVERRIDE;
// Implementation of RenderViewHostDelegateView.
virtual void ShowContextMenu(
diff --git a/content/public/browser/web_contents_view.h b/content/public/browser/web_contents_view.h
index bf2c463..989f716 100644
--- a/content/public/browser/web_contents_view.h
+++ b/content/public/browser/web_contents_view.h
@@ -52,7 +52,7 @@ class CONTENT_EXPORT WebContentsView {
// Computes the rectangle for the native widget that contains the contents of
// the tab in the screen coordinate system.
- virtual void GetContainerBounds(gfx::Rect *out) const = 0;
+ virtual void GetContainerBounds(gfx::Rect* out) const = 0;
// Helper function for GetContainerBounds. Most callers just want to know the
// size, and this makes it more clear.
@@ -69,8 +69,7 @@ class CONTENT_EXPORT WebContentsView {
virtual void SetPageTitle(const string16& title) = 0;
// Used to notify the view that a tab has crashed.
- virtual void OnTabCrashed(base::TerminationStatus status,
- int error_code) = 0;
+ virtual void OnTabCrashed(base::TerminationStatus status, int error_code) = 0;
// TODO(brettw) this is a hack. It's used in two places at the time of this
// writing: (1) when render view hosts switch, we need to size the replaced
@@ -118,8 +117,7 @@ class CONTENT_EXPORT WebContentsView {
virtual void CloseTabAfterEventTracking() = 0;
// Get the bounds of the View, relative to the parent.
- // TODO(beng): Return a rect rather than using an out param.
- virtual void GetViewBounds(gfx::Rect* out) const = 0;
+ virtual gfx::Rect GetViewBounds() const = 0;
};
} // namespace content
diff --git a/content/test/test_web_contents_view.cc b/content/test/test_web_contents_view.cc
index d56f1e2..ff74cb3 100644
--- a/content/test/test_web_contents_view.cc
+++ b/content/test/test_web_contents_view.cc
@@ -107,7 +107,8 @@ bool TestWebContentsView::IsEventTracking() const {
void TestWebContentsView::CloseTabAfterEventTracking() {
}
-void TestWebContentsView::GetViewBounds(gfx::Rect* out) const {
+gfx::Rect TestWebContentsView::GetViewBounds() const {
+ return gfx::Rect();
}
} // namespace content
diff --git a/content/test/test_web_contents_view.h b/content/test/test_web_contents_view.h
index 01b2a95..43992a3 100644
--- a/content/test/test_web_contents_view.h
+++ b/content/test/test_web_contents_view.h
@@ -57,7 +57,7 @@ class TestWebContentsView : public WebContentsView,
virtual WebDropData* GetDropData() const OVERRIDE;
virtual bool IsEventTracking() const OVERRIDE;
virtual void CloseTabAfterEventTracking() OVERRIDE;
- virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE;
+ virtual gfx::Rect GetViewBounds() const OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(TestWebContentsView);