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

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

Issue 102993018: Remove UTF string conversion functions from the global namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: aaaaaaaaaa Created 6 years, 12 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 } 965 }
966 966
967 void TestingAutomationProvider::GetTabTitle(int handle, 967 void TestingAutomationProvider::GetTabTitle(int handle,
968 int* title_string_size, 968 int* title_string_size,
969 std::wstring* title) { 969 std::wstring* title) {
970 *title_string_size = -1; // -1 is the error code 970 *title_string_size = -1; // -1 is the error code
971 if (tab_tracker_->ContainsHandle(handle)) { 971 if (tab_tracker_->ContainsHandle(handle)) {
972 NavigationController* tab = tab_tracker_->GetResource(handle); 972 NavigationController* tab = tab_tracker_->GetResource(handle);
973 NavigationEntry* entry = tab->GetActiveEntry(); 973 NavigationEntry* entry = tab->GetActiveEntry();
974 if (entry != NULL) { 974 if (entry != NULL) {
975 *title = UTF16ToWideHack(entry->GetTitleForDisplay(std::string())); 975 *title = base::UTF16ToWideHack(entry->GetTitleForDisplay(std::string()));
976 } else { 976 } else {
977 *title = std::wstring(); 977 *title = std::wstring();
978 } 978 }
979 *title_string_size = static_cast<int>(title->size()); 979 *title_string_size = static_cast<int>(title->size());
980 } 980 }
981 } 981 }
982 982
983 void TestingAutomationProvider::GetTabIndex(int handle, int* tabstrip_index) { 983 void TestingAutomationProvider::GetTabIndex(int handle, int* tabstrip_index) {
984 *tabstrip_index = -1; // -1 is the error code 984 *tabstrip_index = -1; // -1 is the error code
985 985
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 const std::wstring& script, 1026 const std::wstring& script,
1027 IPC::Message* reply_message) { 1027 IPC::Message* reply_message) {
1028 WebContents* web_contents = GetWebContentsForHandle(handle, NULL); 1028 WebContents* web_contents = GetWebContentsForHandle(handle, NULL);
1029 if (!web_contents) { 1029 if (!web_contents) {
1030 AutomationMsg_DomOperation::WriteReplyParams(reply_message, std::string()); 1030 AutomationMsg_DomOperation::WriteReplyParams(reply_message, std::string());
1031 Send(reply_message); 1031 Send(reply_message);
1032 return; 1032 return;
1033 } 1033 }
1034 1034
1035 new DomOperationMessageSender(this, reply_message, false); 1035 new DomOperationMessageSender(this, reply_message, false);
1036 ExecuteJavascriptInRenderViewFrame(WideToUTF16Hack(frame_xpath), 1036 ExecuteJavascriptInRenderViewFrame(base::WideToUTF16Hack(frame_xpath),
1037 WideToUTF16Hack(script), reply_message, 1037 base::WideToUTF16Hack(script),
1038 reply_message,
1038 web_contents->GetRenderViewHost()); 1039 web_contents->GetRenderViewHost());
1039 } 1040 }
1040 1041
1041 // Sample json input: { "command": "OpenNewBrowserWindowWithNewProfile" } 1042 // Sample json input: { "command": "OpenNewBrowserWindowWithNewProfile" }
1042 // Sample output: {} 1043 // Sample output: {}
1043 void TestingAutomationProvider::OpenNewBrowserWindowWithNewProfile( 1044 void TestingAutomationProvider::OpenNewBrowserWindowWithNewProfile(
1044 base::DictionaryValue* args, IPC::Message* reply_message) { 1045 base::DictionaryValue* args, IPC::Message* reply_message) {
1045 ProfileManager* profile_manager = g_browser_process->profile_manager(); 1046 ProfileManager* profile_manager = g_browser_process->profile_manager();
1046 new BrowserOpenedWithNewProfileNotificationObserver(this, reply_message); 1047 new BrowserOpenedWithNewProfileNotificationObserver(this, reply_message);
1047 profile_manager->CreateMultiProfileAsync( 1048 profile_manager->CreateMultiProfileAsync(
(...skipping 4416 matching lines...) Expand 10 before | Expand all | Expand 10 after
5464 if (g_browser_process) 5465 if (g_browser_process)
5465 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 5466 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
5466 } 5467 }
5467 5468
5468 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 5469 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
5469 WebContents* tab) { 5470 WebContents* tab) {
5470 TabStripModel* tab_strip = browser->tab_strip_model(); 5471 TabStripModel* tab_strip = browser->tab_strip_model();
5471 if (tab_strip->GetActiveWebContents() != tab) 5472 if (tab_strip->GetActiveWebContents() != tab)
5472 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); 5473 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true);
5473 } 5474 }
OLDNEW
« no previous file with comments | « base/test/test_file_util_posix.cc ('k') | chrome/browser/importer/firefox_importer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698