blob: fb6462cb9c002544447b26e95ab08085ba4d46bc (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// Copyright (c) 2012 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/testing_automation_provider.h"
#include "ash/wm/window_util.h"
#include "base/logging.h"
#include "chrome/browser/automation/automation_window_tracker.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/base/ui_base_types.h"
void TestingAutomationProvider::ActivateWindow(int handle) {
aura::Window* window = window_tracker_->GetResource(handle);
if (window) {
ash::ActivateWindow(window);
}
}
void TestingAutomationProvider::IsWindowMaximized(int handle,
bool* is_maximized,
bool* success) {
aura::Window* window = window_tracker_->GetResource(handle);
if (window) {
*is_maximized = window->GetProperty(aura::client::kShowStateKey) ==
ui::SHOW_STATE_MAXIMIZED;
*success = true;
} else {
*success = false;
}
}
void TestingAutomationProvider::TerminateSession(int handle, bool* success) {
*success = false;
}
void TestingAutomationProvider::GetWindowBounds(int handle,
gfx::Rect* bounds,
bool* success) {
const aura::Window* window = window_tracker_->GetResource(handle);
if (window) {
*bounds = window->bounds();
*success = true;
} else {
*success = false;
}
}
void TestingAutomationProvider::SetWindowBounds(int handle,
const gfx::Rect& bounds,
bool* success) {
aura::Window* window = window_tracker_->GetResource(handle);
if (window) {
window->SetBounds(bounds);
*success = true;
} else {
*success = false;
}
}
void TestingAutomationProvider::SetWindowVisible(int handle,
bool visible,
bool* result) {
aura::Window* window = window_tracker_->GetResource(handle);
if (window) {
if (visible) {
window->Show();
} else {
window->Hide();
}
*result = true;
} else {
*result = false;
}
}
void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) {
const aura::Window* window = window_tracker_->GetResource(handle);
DCHECK(window);
*text = window->title();
}
|