Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/automation/automation_window_tracker.h" | |
| 5 #include "chrome/browser/automation/testing_automation_provider.h" | 6 #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.
| |
| 7 #include "ui/aura/window.h" | |
| 6 | 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 | 10 |
| 9 void TestingAutomationProvider::ActivateWindow(int handle) { | 11 void TestingAutomationProvider::ActivateWindow(int handle) { |
| 10 // TODO(beng): | 12 if (aura::Window* window = window_tracker_->GetResource(handle)) { |
| 11 NOTIMPLEMENTED(); | 13 window->Activate(); |
| 14 } else { | |
| 15 // TODO(benrg): Is it correct to fail silently? The Windows provider does. | |
| 16 } | |
| 12 } | 17 } |
| 13 | 18 |
| 14 void TestingAutomationProvider::IsWindowMaximized(int handle, | 19 void TestingAutomationProvider::IsWindowMaximized(int handle, |
| 15 bool* is_maximized, | 20 bool* is_maximized, |
| 16 bool* success) { | 21 bool* success) { |
| 17 // TODO(beng): | 22 // 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.
| |
| 18 NOTIMPLEMENTED(); | 23 NOTIMPLEMENTED(); |
| 19 } | 24 } |
| 20 | 25 |
| 21 void TestingAutomationProvider::TerminateSession(int handle, bool* success) { | 26 void TestingAutomationProvider::TerminateSession(int handle, bool* success) { |
| 22 // TODO(beng): | 27 // TODO(benrg): what should this do in aura? It's |
| 28 // 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.
| |
| 23 NOTIMPLEMENTED(); | 29 NOTIMPLEMENTED(); |
| 24 } | 30 } |
| 25 | 31 |
| 26 void TestingAutomationProvider::GetWindowBounds(int handle, | 32 void TestingAutomationProvider::GetWindowBounds(int handle, |
| 27 gfx::Rect* bounds, | 33 gfx::Rect* bounds, |
| 28 bool* success) { | 34 bool* success) { |
| 29 // TODO(beng): | 35 if (const aura::Window* window = window_tracker_->GetResource(handle)) { |
| 30 NOTIMPLEMENTED(); | 36 *bounds = window->bounds(); |
| 37 *success = true; | |
| 38 } else { | |
| 39 *success = false; | |
| 40 } | |
| 31 } | 41 } |
| 32 | 42 |
| 33 void TestingAutomationProvider::SetWindowBounds(int handle, | 43 void TestingAutomationProvider::SetWindowBounds(int handle, |
| 34 const gfx::Rect& bounds, | 44 const gfx::Rect& bounds, |
| 35 bool* success) { | 45 bool* success) { |
| 36 // TODO(beng): | 46 if (aura::Window* window = window_tracker_->GetResource(handle)) { |
| 37 NOTIMPLEMENTED(); | 47 window->SetBounds(bounds); |
| 48 *success = true; | |
| 49 } else { | |
| 50 *success = false; | |
| 51 } | |
| 38 } | 52 } |
| 39 | 53 |
| 40 void TestingAutomationProvider::SetWindowVisible(int handle, | 54 void TestingAutomationProvider::SetWindowVisible(int handle, |
| 41 bool visible, | 55 bool visible, |
| 42 bool* result) { | 56 bool* result) { |
| 43 // TODO(beng): | 57 if (aura::Window* window = window_tracker_->GetResource(handle)) { |
| 44 NOTIMPLEMENTED(); | 58 if (visible) { |
| 59 window->Show(); | |
| 60 } else { | |
| 61 window->Hide(); | |
| 62 } | |
| 63 *result = true; | |
| 64 } else { | |
| 65 *result = false; | |
| 66 } | |
| 45 } | 67 } |
| 46 | 68 |
| 47 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { | 69 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { |
| 48 // TODO(beng): | 70 const aura::Window* window = window_tracker_->GetResource(handle); |
| 49 NOTIMPLEMENTED(); | 71 // 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.
| |
| 72 *text = window->title(); | |
| 50 } | 73 } |
| 51 | 74 |
| OLD | NEW |