Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 10538039: Renamed BrowserWindow::GetNativeHandle() to GetNativeWindow() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update copyrights Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 *handle = 0; 664 *handle = 0;
665 Browser* browser = browser::FindTabbedBrowser(profile_, false); 665 Browser* browser = browser::FindTabbedBrowser(profile_, false);
666 if (browser) 666 if (browser)
667 *handle = browser_tracker_->Add(browser); 667 *handle = browser_tracker_->Add(browser);
668 } 668 }
669 669
670 void TestingAutomationProvider::GetActiveWindow(int* handle) { 670 void TestingAutomationProvider::GetActiveWindow(int* handle) {
671 *handle = 0; 671 *handle = 0;
672 Browser* browser = BrowserList::GetLastActive(); 672 Browser* browser = BrowserList::GetLastActive();
673 if (browser) { 673 if (browser) {
674 gfx::NativeWindow window = browser->window()->GetNativeHandle(); 674 gfx::NativeWindow window = browser->window()->GetNativeWindow();
675 *handle = window_tracker_->Add(window); 675 *handle = window_tracker_->Add(window);
676 } 676 }
677 } 677 }
678 678
679 void TestingAutomationProvider::ExecuteBrowserCommandAsync(int handle, 679 void TestingAutomationProvider::ExecuteBrowserCommandAsync(int handle,
680 int command, 680 int command,
681 bool* success) { 681 bool* success) {
682 *success = false; 682 *success = false;
683 if (!browser_tracker_->ContainsHandle(handle)) { 683 if (!browser_tracker_->ContainsHandle(handle)) {
684 LOG(WARNING) << "Browser tracker does not contain handle: " << handle; 684 LOG(WARNING) << "Browser tracker does not contain handle: " << handle;
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 } 1210 }
1211 1211
1212 void TestingAutomationProvider::GetWindowForBrowser(int browser_handle, 1212 void TestingAutomationProvider::GetWindowForBrowser(int browser_handle,
1213 bool* success, 1213 bool* success,
1214 int* handle) { 1214 int* handle) {
1215 *success = false; 1215 *success = false;
1216 *handle = 0; 1216 *handle = 0;
1217 1217
1218 if (browser_tracker_->ContainsHandle(browser_handle)) { 1218 if (browser_tracker_->ContainsHandle(browser_handle)) {
1219 Browser* browser = browser_tracker_->GetResource(browser_handle); 1219 Browser* browser = browser_tracker_->GetResource(browser_handle);
1220 gfx::NativeWindow win = browser->window()->GetNativeHandle(); 1220 gfx::NativeWindow win = browser->window()->GetNativeWindow();
1221 // Add() returns the existing handle for the resource if any. 1221 // Add() returns the existing handle for the resource if any.
1222 *handle = window_tracker_->Add(win); 1222 *handle = window_tracker_->Add(win);
1223 *success = true; 1223 *success = true;
1224 } 1224 }
1225 } 1225 }
1226 1226
1227 void TestingAutomationProvider::WaitForTabToBeRestored( 1227 void TestingAutomationProvider::WaitForTabToBeRestored(
1228 int tab_handle, 1228 int tab_handle,
1229 IPC::Message* reply_message) { 1229 IPC::Message* reply_message) {
1230 if (tab_tracker_->ContainsHandle(tab_handle)) { 1230 if (tab_tracker_->ContainsHandle(tab_handle)) {
(...skipping 4178 matching lines...) Expand 10 before | Expand all | Expand 10 after
5409 // containing the element we send the text in to be shown. 5409 // containing the element we send the text in to be shown.
5410 browser->ActivateTabAt( 5410 browser->ActivateTabAt(
5411 browser->GetIndexOfController(&web_contents->GetController()), true); 5411 browser->GetIndexOfController(&web_contents->GetController()), true);
5412 5412
5413 BrowserWindow* browser_window = browser->window(); 5413 BrowserWindow* browser_window = browser->window();
5414 if (!browser_window) { 5414 if (!browser_window) {
5415 AutomationJSONReply(this, reply_message) 5415 AutomationJSONReply(this, reply_message)
5416 .SendError("Could not get the browser window"); 5416 .SendError("Could not get the browser window");
5417 return; 5417 return;
5418 } 5418 }
5419 gfx::NativeWindow window = browser_window->GetNativeHandle(); 5419 gfx::NativeWindow window = browser_window->GetNativeWindow();
5420 if (!window) { 5420 if (!window) {
5421 AutomationJSONReply(this, reply_message) 5421 AutomationJSONReply(this, reply_message)
5422 .SendError("Could not get the browser window handle"); 5422 .SendError("Could not get the browser window handle");
5423 return; 5423 return;
5424 } 5424 }
5425 5425
5426 bool control = !!(modifiers & automation::kControlKeyMask); 5426 bool control = !!(modifiers & automation::kControlKeyMask);
5427 bool shift = !!(modifiers & automation::kShiftKeyMask); 5427 bool shift = !!(modifiers & automation::kShiftKeyMask);
5428 bool alt = !!(modifiers & automation::kAltKeyMask); 5428 bool alt = !!(modifiers & automation::kAltKeyMask);
5429 bool meta = !!(modifiers & automation::kMetaKeyMask); 5429 bool meta = !!(modifiers & automation::kMetaKeyMask);
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
6671 } 6671 }
6672 6672
6673 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 6673 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
6674 WebContents* tab) { 6674 WebContents* tab) {
6675 if (browser->GetSelectedWebContents() != tab || 6675 if (browser->GetSelectedWebContents() != tab ||
6676 browser != BrowserList::GetLastActive()) { 6676 browser != BrowserList::GetLastActive()) {
6677 browser->ActivateTabAt(browser->GetIndexOfController(&tab->GetController()), 6677 browser->ActivateTabAt(browser->GetIndexOfController(&tab->GetController()),
6678 true /* user_gesture */); 6678 true /* user_gesture */);
6679 } 6679 }
6680 } 6680 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698