1 // Copyright (c) 2012 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"
9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/automation/automation_browser_tracker.h"
12 #include "chrome/browser/automation/automation_window_tracker.h"
13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_window.h"
16 void TestingAutomationProvider::TerminateSession(int handle
, bool* success
) {
19 if (browser_tracker_
->ContainsHandle(handle
)) {
20 Browser
* browser
= browser_tracker_
->GetResource(handle
);
21 HWND window
= browser
->window()->GetNativeWindow();
22 *success
= (::PostMessageW(window
, WM_ENDSESSION
, 0, 0) == TRUE
);
26 void TestingAutomationProvider::SetWindowBounds(int handle
,
27 const gfx::Rect
& bounds
,
30 if (window_tracker_
->ContainsHandle(handle
)) {
31 HWND hwnd
= window_tracker_
->GetResource(handle
);
32 if (::MoveWindow(hwnd
, bounds
.x(), bounds
.y(), bounds
.width(),
33 bounds
.height(), true)) {