1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/test/automation/window_proxy.h"
6
7 #include <algorithm>
8 #include <vector>
9
10 #include "base/logging.h"
11 #include "chrome/common/automation_constants.h"
12 #include "chrome/common/automation_messages.h"
13 #include "chrome/test/automation/automation_proxy.h"
14 #include "chrome/test/automation/browser_proxy.h"
15 #include "chrome/test/automation/tab_proxy.h"
16 #include "ui/gfx/rect.h"
17 #include "url/gurl.h"
18
GetViewBounds(int view_id,gfx::Rect * bounds,bool screen_coordinates)19 bool WindowProxy::GetViewBounds(int view_id, gfx::Rect* bounds,
20 bool screen_coordinates) {
21 if (!is_valid())
22 return false;
23
24 if (!bounds) {
25 NOTREACHED();
26 return false;
27 }
28
29 bool result = false;
30
31 if (!sender_->Send(new AutomationMsg_WindowViewBounds(
32 handle_, view_id, screen_coordinates, &result, bounds))) {
33 return false;
34 }
35
36 return result;
37 }
38
SetBounds(const gfx::Rect & bounds)39 bool WindowProxy::SetBounds(const gfx::Rect& bounds) {
40 if (!is_valid())
41 return false;
42 bool result = false;
43 sender_->Send(new AutomationMsg_SetWindowBounds(handle_, bounds, &result));
44 return result;
45 }
46