1// Copyright (c) 2010 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#ifndef CHROME_TEST_AUTOMATION_WINDOW_PROXY_H__ 6#define CHROME_TEST_AUTOMATION_WINDOW_PROXY_H__ 7 8#include "build/build_config.h" 9 10#if defined(OS_WIN) 11#include <windows.h> 12#endif 13 14#include "base/strings/string16.h" 15#include "base/threading/thread.h" 16#include "chrome/test/automation/automation_handle_tracker.h" 17 18class BrowserProxy; 19class WindowProxy; 20 21namespace gfx { 22class Rect; 23} 24 25// This class presents the interface to actions that can be performed on a given 26// window. Note that this object can be invalidated at any time if the 27// corresponding window in the app is closed. In that case, any subsequent 28// calls will return false immediately. 29class WindowProxy : public AutomationResourceProxy { 30 public: 31 WindowProxy(AutomationMessageSender* sender, 32 AutomationHandleTracker* tracker, 33 int handle) 34 : AutomationResourceProxy(tracker, sender, handle) {} 35 36 // Gets the bounds (in window coordinates) that correspond to the view with 37 // the given ID in this window. Returns true if bounds could be obtained. 38 // If |screen_coordinates| is true, the bounds are returned in the coordinates 39 // of the screen, if false in the coordinates of the browser. 40 bool GetViewBounds(int view_id, gfx::Rect* bounds, bool screen_coordinates); 41 42 // Sets the position and size of the window. Returns true if setting the 43 // bounds was successful. 44 bool SetBounds(const gfx::Rect& bounds); 45 46 protected: 47 virtual ~WindowProxy() {} 48 private: 49 DISALLOW_COPY_AND_ASSIGN(WindowProxy); 50}; 51 52#endif // CHROME_TEST_AUTOMATION_WINDOW_PROXY_H__ 53