blob: 02cb229565dfe6cad187f8aae0d7a75c435ff651 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Copyright (c) 2009 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.
#include "chrome/browser/automation/automation_provider.h"
#include "base/gfx/point.h"
#include "views/view.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
void AutomationProvider::WindowGetViewBounds(int handle, int view_id,
bool screen_coordinates,
bool* success,
gfx::Rect* bounds) {
*success = false;
if (window_tracker_->ContainsHandle(handle)) {
gfx::NativeWindow window = window_tracker_->GetResource(handle);
views::RootView* root_view = views::Widget::FindRootView(window);
if (root_view) {
views::View* view = root_view->GetViewByID(view_id);
if (view) {
*success = true;
gfx::Point point;
if (screen_coordinates)
views::View::ConvertPointToScreen(view, &point);
else
views::View::ConvertPointToView(view, root_view, &point);
*bounds = view->GetLocalBounds(false);
bounds->set_origin(point);
}
}
}
}
|