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..88130af6dfc2b6abacdc99be1c00cbbe4fe50715 100644 |
| --- a/chrome/browser/automation/testing_automation_provider_aura.cc |
| +++ b/chrome/browser/automation/testing_automation_provider_aura.cc |
| @@ -5,47 +5,76 @@ |
| #include "chrome/browser/automation/testing_automation_provider.h" |
| #include "base/logging.h" |
| +#include "chrome/browser/automation/automation_window_tracker.h" |
| +#include "ui/aura/window.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): |
| - NOTIMPLEMENTED(); |
| + if (aura::Window* window = window_tracker_->GetResource(handle)) { |
|
sky
2011/11/14 21:25:10
nit: move assignment out of conditional (just like
benrg
2011/11/14 22:59:40
Done.
|
| + int show_state = window->GetIntProperty(aura::kShowStateKey); |
| + *is_maximized = (show_state == SHOW_STATE_MAXIMIZED); |
| + *success = true; |
| + } else { |
| + *success = false; |
| + } |
| } |
| 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. |
| + *success = false; |
| 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); |
| + DCHECK(window); |
| + *text = window->title(); |
| } |