OLD | NEW |
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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 // See GetMultiProfileInfo() in pyauto.py for sample output. | 1048 // See GetMultiProfileInfo() in pyauto.py for sample output. |
1049 void TestingAutomationProvider::GetMultiProfileInfo( | 1049 void TestingAutomationProvider::GetMultiProfileInfo( |
1050 base::DictionaryValue* args, IPC::Message* reply_message) { | 1050 base::DictionaryValue* args, IPC::Message* reply_message) { |
1051 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 1051 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
1052 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1052 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1053 const ProfileInfoCache& profile_info_cache = | 1053 const ProfileInfoCache& profile_info_cache = |
1054 profile_manager->GetProfileInfoCache(); | 1054 profile_manager->GetProfileInfoCache(); |
1055 return_value->SetBoolean("enabled", profiles::IsMultipleProfilesEnabled()); | 1055 return_value->SetBoolean("enabled", profiles::IsMultipleProfilesEnabled()); |
1056 | 1056 |
1057 ListValue* profiles = new ListValue; | 1057 ListValue* profiles = new ListValue; |
1058 for (size_t index = 0; index < profile_info_cache.GetNumberOfProfiles(); | 1058 |
1059 ++index) { | 1059 const std::vector<ProfileInfoEntry> entries( |
| 1060 profile_info_cache.GetProfilesSortedByName()); |
| 1061 for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin(); |
| 1062 it != entries.end(); ++it) { |
1060 DictionaryValue* item = new DictionaryValue; | 1063 DictionaryValue* item = new DictionaryValue; |
1061 item->SetString("name", profile_info_cache.GetNameOfProfileAtIndex(index)); | 1064 item->SetString("name", it->GetDisplayName()); |
1062 item->SetString("path", | 1065 item->SetString("path", it->path().value()); |
1063 profile_info_cache.GetPathOfProfileAtIndex(index).value()); | |
1064 profiles->Append(item); | 1066 profiles->Append(item); |
1065 } | 1067 } |
1066 return_value->Set("profiles", profiles); | 1068 return_value->Set("profiles", profiles); |
1067 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); | 1069 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
1068 } | 1070 } |
1069 | 1071 |
1070 void TestingAutomationProvider::OpenNewBrowserWindowOfType( | 1072 void TestingAutomationProvider::OpenNewBrowserWindowOfType( |
1071 int type, bool show, IPC::Message* reply_message) { | 1073 int type, bool show, IPC::Message* reply_message) { |
1072 new BrowserOpenedNotificationObserver(this, reply_message, false); | 1074 new BrowserOpenedNotificationObserver(this, reply_message, false); |
1073 // We may have no current browser windows open so don't rely on | 1075 // We may have no current browser windows open so don't rely on |
(...skipping 4378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5452 if (g_browser_process) | 5454 if (g_browser_process) |
5453 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 5455 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
5454 } | 5456 } |
5455 | 5457 |
5456 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 5458 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
5457 WebContents* tab) { | 5459 WebContents* tab) { |
5458 TabStripModel* tab_strip = browser->tab_strip_model(); | 5460 TabStripModel* tab_strip = browser->tab_strip_model(); |
5459 if (tab_strip->GetActiveWebContents() != tab) | 5461 if (tab_strip->GetActiveWebContents() != tab) |
5460 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 5462 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
5461 } | 5463 } |
OLD | NEW |