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

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

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 } 984 }
985 985
986 void TestingAutomationProvider::GetTabTitle(int handle, 986 void TestingAutomationProvider::GetTabTitle(int handle,
987 int* title_string_size, 987 int* title_string_size,
988 std::wstring* title) { 988 std::wstring* title) {
989 *title_string_size = -1; // -1 is the error code 989 *title_string_size = -1; // -1 is the error code
990 if (tab_tracker_->ContainsHandle(handle)) { 990 if (tab_tracker_->ContainsHandle(handle)) {
991 NavigationController* tab = tab_tracker_->GetResource(handle); 991 NavigationController* tab = tab_tracker_->GetResource(handle);
992 NavigationEntry* entry = tab->GetActiveEntry(); 992 NavigationEntry* entry = tab->GetActiveEntry();
993 if (entry != NULL) { 993 if (entry != NULL) {
994 *title = UTF16ToWideHack(entry->GetTitleForDisplay("")); 994 *title = UTF16ToWideHack(entry->GetTitleForDisplay(std::string()));
995 } else { 995 } else {
996 *title = std::wstring(); 996 *title = std::wstring();
997 } 997 }
998 *title_string_size = static_cast<int>(title->size()); 998 *title_string_size = static_cast<int>(title->size());
999 } 999 }
1000 } 1000 }
1001 1001
1002 void TestingAutomationProvider::GetTabIndex(int handle, int* tabstrip_index) { 1002 void TestingAutomationProvider::GetTabIndex(int handle, int* tabstrip_index) {
1003 *tabstrip_index = -1; // -1 is the error code 1003 *tabstrip_index = -1; // -1 is the error code
1004 1004
(...skipping 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 browser->profile(), Profile::EXPLICIT_ACCESS); 3407 browser->profile(), Profile::EXPLICIT_ACCESS);
3408 if (password_store == NULL) { 3408 if (password_store == NULL) {
3409 AutomationJSONReply(this, reply_message).SendError( 3409 AutomationJSONReply(this, reply_message).SendError(
3410 "Unable to get password store."); 3410 "Unable to get password store.");
3411 return; 3411 return;
3412 } 3412 }
3413 3413
3414 // This observer will delete itself. 3414 // This observer will delete itself.
3415 PasswordStoreLoginsChangedObserver* observer = 3415 PasswordStoreLoginsChangedObserver* observer =
3416 new PasswordStoreLoginsChangedObserver( 3416 new PasswordStoreLoginsChangedObserver(
3417 this, reply_message, PasswordStoreChange::REMOVE, ""); 3417 this, reply_message, PasswordStoreChange::REMOVE, std::string());
3418 observer->Init(); 3418 observer->Init();
3419 3419
3420 password_store->RemoveLogin(to_remove); 3420 password_store->RemoveLogin(to_remove);
3421 } 3421 }
3422 3422
3423 // Sample json input: { "command": "GetSavedPasswords" } 3423 // Sample json input: { "command": "GetSavedPasswords" }
3424 // Refer to GetSavedPasswords() in chrome/test/pyautolib/pyauto.py for sample 3424 // Refer to GetSavedPasswords() in chrome/test/pyautolib/pyauto.py for sample
3425 // json output. 3425 // json output.
3426 void TestingAutomationProvider::GetSavedPasswords( 3426 void TestingAutomationProvider::GetSavedPasswords(
3427 Browser* browser, 3427 Browser* browser,
(...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after
5346 Browser* browser; 5346 Browser* browser;
5347 WebContents* tab; 5347 WebContents* tab;
5348 std::string error; 5348 std::string error;
5349 if (GetBrowserAndTabFromJSONArgs(args, &browser, &tab, &error)) { 5349 if (GetBrowserAndTabFromJSONArgs(args, &browser, &tab, &error)) {
5350 NavigationEntry* entry = tab->GetController().GetActiveEntry(); 5350 NavigationEntry* entry = tab->GetController().GetActiveEntry();
5351 if (!entry) { 5351 if (!entry) {
5352 reply.SendError("Unable to get active navigation entry"); 5352 reply.SendError("Unable to get active navigation entry");
5353 return; 5353 return;
5354 } 5354 }
5355 DictionaryValue dict; 5355 DictionaryValue dict;
5356 dict.SetString("title", entry->GetTitleForDisplay("")); 5356 dict.SetString("title", entry->GetTitleForDisplay(std::string()));
5357 dict.SetString("url", entry->GetVirtualURL().spec()); 5357 dict.SetString("url", entry->GetVirtualURL().spec());
5358 reply.SendSuccess(&dict); 5358 reply.SendSuccess(&dict);
5359 } else { 5359 } else {
5360 reply.SendError(error); 5360 reply.SendError(error);
5361 } 5361 }
5362 } 5362 }
5363 5363
5364 void TestingAutomationProvider::GetTabCountJSON( 5364 void TestingAutomationProvider::GetTabCountJSON(
5365 DictionaryValue* args, 5365 DictionaryValue* args,
5366 IPC::Message* reply_message) { 5366 IPC::Message* reply_message) {
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
5916 if (g_browser_process) 5916 if (g_browser_process)
5917 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 5917 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
5918 } 5918 }
5919 5919
5920 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 5920 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
5921 WebContents* tab) { 5921 WebContents* tab) {
5922 TabStripModel* tab_strip = browser->tab_strip_model(); 5922 TabStripModel* tab_strip = browser->tab_strip_model();
5923 if (tab_strip->GetActiveWebContents() != tab) 5923 if (tab_strip->GetActiveWebContents() != tab)
5924 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); 5924 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true);
5925 } 5925 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_misc_browsertest.cc ('k') | chrome/browser/bookmarks/bookmark_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698