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/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 HWND hwnd = window_tracker_->GetResource(handle); | 79 HWND hwnd = window_tracker_->GetResource(handle); |
80 ::ShowWindow(hwnd, visible ? SW_SHOW : SW_HIDE); | 80 ::ShowWindow(hwnd, visible ? SW_SHOW : SW_HIDE); |
81 *result = true; | 81 *result = true; |
82 } else { | 82 } else { |
83 *result = false; | 83 *result = false; |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { | 87 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { |
88 gfx::NativeWindow window = window_tracker_->GetResource(handle); | 88 gfx::NativeWindow window = window_tracker_->GetResource(handle); |
89 std::wstring result; | |
90 int length = ::GetWindowTextLength(window) + 1; | 89 int length = ::GetWindowTextLength(window) + 1; |
91 ::GetWindowText(window, WriteInto(&result, length), length); | 90 if (length > 1) |
92 text->assign(WideToUTF16(result)); | 91 ::GetWindowText(window, WriteInto(text, length), length); |
| 92 else |
| 93 text->clear(); |
93 } | 94 } |
94 | 95 |
OLD | NEW |