Chromium Code Reviews| Index: chrome/browser/automation/testing_automation_provider_aura.cc |
| diff --git a/chrome/browser/automation/testing_automation_provider_aura.cc b/chrome/browser/automation/testing_automation_provider_aura.cc |
| index 191dbbbb1da905ed855d70f08224de5f199bd2d6..8b0c35c9fa340b2fc8d0a74fd32e2ea06989d27a 100644 |
| --- a/chrome/browser/automation/testing_automation_provider_aura.cc |
| +++ b/chrome/browser/automation/testing_automation_provider_aura.cc |
| @@ -2,50 +2,73 @@ |
| // 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_window_tracker.h" |
| #include "chrome/browser/automation/testing_automation_provider.h" |
|
sky
2011/11/14 17:39:24
For .cc files you want this format for includes: i
benrg
2011/11/14 20:50:53
Done.
|
| +#include "ui/aura/window.h" |
| #include "base/logging.h" |
| void TestingAutomationProvider::ActivateWindow(int handle) { |
| - // TODO(beng): |
| - NOTIMPLEMENTED(); |
| + if (aura::Window* window = window_tracker_->GetResource(handle)) { |
| + window->Activate(); |
| + } else { |
| + // TODO(benrg): Is it correct to fail silently? The Windows provider does. |
| + } |
| } |
| void TestingAutomationProvider::IsWindowMaximized(int handle, |
| bool* is_maximized, |
| bool* success) { |
| - // TODO(beng): |
| + // TODO(benrg): how? |
|
sky
2011/11/14 17:39:24
This state is stored in the properties of the wind
benrg
2011/11/14 20:50:53
Done.
|
| NOTIMPLEMENTED(); |
| } |
| void TestingAutomationProvider::TerminateSession(int handle, bool* success) { |
| - // TODO(beng): |
| + // TODO(benrg): what should this do in aura? It's |
| + // currently unimplemented in most other providers. |
|
sky
2011/11/14 17:39:24
Set *success to false here.
benrg
2011/11/14 20:50:53
Done.
|
| NOTIMPLEMENTED(); |
| } |
| void TestingAutomationProvider::GetWindowBounds(int handle, |
| gfx::Rect* bounds, |
| bool* success) { |
| - // TODO(beng): |
| - NOTIMPLEMENTED(); |
| + if (const aura::Window* window = window_tracker_->GetResource(handle)) { |
| + *bounds = window->bounds(); |
| + *success = true; |
| + } else { |
| + *success = false; |
| + } |
| } |
| void TestingAutomationProvider::SetWindowBounds(int handle, |
| const gfx::Rect& bounds, |
| bool* success) { |
| - // TODO(beng): |
| - NOTIMPLEMENTED(); |
| + if (aura::Window* window = window_tracker_->GetResource(handle)) { |
| + window->SetBounds(bounds); |
| + *success = true; |
| + } else { |
| + *success = false; |
| + } |
| } |
| void TestingAutomationProvider::SetWindowVisible(int handle, |
| bool visible, |
| bool* result) { |
| - // TODO(beng): |
| - NOTIMPLEMENTED(); |
| + if (aura::Window* window = window_tracker_->GetResource(handle)) { |
| + if (visible) { |
| + window->Show(); |
| + } else { |
| + window->Hide(); |
| + } |
| + *result = true; |
| + } else { |
| + *result = false; |
| + } |
| } |
| void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { |
| - // TODO(beng): |
| - NOTIMPLEMENTED(); |
| + const aura::Window* window = window_tracker_->GetResource(handle); |
| + // TODO(benrg): Windows provider uses this pointer without testing for NULL. |
|
sky
2011/11/14 17:39:24
You should NULL check.
benrg
2011/11/14 20:50:53
Done.
|
| + *text = window->title(); |
| } |