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