1 // Copyright (c) 2011 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.
5 #include "chrome/browser/automation/testing_automation_provider.h"
7 #include "chrome/browser/automation/automation_window_tracker.h"
8 #include "ui/views/view.h"
9 #include "ui/views/widget/widget.h"
11 void TestingAutomationProvider::WindowGetViewBounds(int handle
,
13 bool screen_coordinates
,
18 if (window_tracker_
->ContainsHandle(handle
)) {
19 gfx::NativeWindow window
= window_tracker_
->GetResource(handle
);
20 views::Widget
* widget
= views::Widget::GetWidgetForNativeWindow(window
);
22 views::View
* root_view
= widget
->GetRootView();
23 views::View
* view
= root_view
->GetViewByID(view_id
);
27 if (screen_coordinates
)
28 views::View::ConvertPointToScreen(view
, &point
);
30 views::View::ConvertPointToTarget(view
, root_view
, &point
);
31 *bounds
= view
->GetContentsBounds();
32 bounds
->set_origin(point
);