| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 #include "chrome/browser/notifications/notification.h" | 71 #include "chrome/browser/notifications/notification.h" |
| 72 #include "chrome/browser/password_manager/password_store.h" | 72 #include "chrome/browser/password_manager/password_store.h" |
| 73 #include "chrome/browser/password_manager/password_store_change.h" | 73 #include "chrome/browser/password_manager/password_store_change.h" |
| 74 #include "chrome/browser/password_manager/password_store_factory.h" | 74 #include "chrome/browser/password_manager/password_store_factory.h" |
| 75 #include "chrome/browser/platform_util.h" | 75 #include "chrome/browser/platform_util.h" |
| 76 #include "chrome/browser/plugins/plugin_prefs.h" | 76 #include "chrome/browser/plugins/plugin_prefs.h" |
| 77 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 77 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
| 78 #include "chrome/browser/profiles/profile.h" | 78 #include "chrome/browser/profiles/profile.h" |
| 79 #include "chrome/browser/profiles/profile_info_cache.h" | 79 #include "chrome/browser/profiles/profile_info_cache.h" |
| 80 #include "chrome/browser/profiles/profile_manager.h" | 80 #include "chrome/browser/profiles/profile_manager.h" |
| 81 #include "chrome/browser/profiles/profile_window.h" |
| 82 #include "chrome/browser/profiles/profiles_state.h" |
| 81 #include "chrome/browser/search_engines/template_url.h" | 83 #include "chrome/browser/search_engines/template_url.h" |
| 82 #include "chrome/browser/search_engines/template_url_service.h" | 84 #include "chrome/browser/search_engines/template_url_service.h" |
| 83 #include "chrome/browser/search_engines/template_url_service_factory.h" | 85 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 84 #include "chrome/browser/sessions/session_service_factory.h" | 86 #include "chrome/browser/sessions/session_service_factory.h" |
| 85 #include "chrome/browser/sessions/session_tab_helper.h" | 87 #include "chrome/browser/sessions/session_tab_helper.h" |
| 86 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 88 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
| 87 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 89 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
| 88 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h" | 90 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h" |
| 89 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" | 91 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
| 90 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 92 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 } | 1052 } |
| 1051 | 1053 |
| 1052 // Sample json input: { "command": "GetMultiProfileInfo" } | 1054 // Sample json input: { "command": "GetMultiProfileInfo" } |
| 1053 // See GetMultiProfileInfo() in pyauto.py for sample output. | 1055 // See GetMultiProfileInfo() in pyauto.py for sample output. |
| 1054 void TestingAutomationProvider::GetMultiProfileInfo( | 1056 void TestingAutomationProvider::GetMultiProfileInfo( |
| 1055 base::DictionaryValue* args, IPC::Message* reply_message) { | 1057 base::DictionaryValue* args, IPC::Message* reply_message) { |
| 1056 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 1058 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
| 1057 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1059 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 1058 const ProfileInfoCache& profile_info_cache = | 1060 const ProfileInfoCache& profile_info_cache = |
| 1059 profile_manager->GetProfileInfoCache(); | 1061 profile_manager->GetProfileInfoCache(); |
| 1060 return_value->SetBoolean("enabled", | 1062 return_value->SetBoolean("enabled", profiles::IsMultipleProfilesEnabled()); |
| 1061 profile_manager->IsMultipleProfilesEnabled()); | |
| 1062 | 1063 |
| 1063 ListValue* profiles = new ListValue; | 1064 ListValue* profiles = new ListValue; |
| 1064 for (size_t index = 0; index < profile_info_cache.GetNumberOfProfiles(); | 1065 for (size_t index = 0; index < profile_info_cache.GetNumberOfProfiles(); |
| 1065 ++index) { | 1066 ++index) { |
| 1066 DictionaryValue* item = new DictionaryValue; | 1067 DictionaryValue* item = new DictionaryValue; |
| 1067 item->SetString("name", profile_info_cache.GetNameOfProfileAtIndex(index)); | 1068 item->SetString("name", profile_info_cache.GetNameOfProfileAtIndex(index)); |
| 1068 item->SetString("path", | 1069 item->SetString("path", |
| 1069 profile_info_cache.GetPathOfProfileAtIndex(index).value()); | 1070 profile_info_cache.GetPathOfProfileAtIndex(index).value()); |
| 1070 profiles->Append(item); | 1071 profiles->Append(item); |
| 1071 } | 1072 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 return; | 1146 return; |
| 1146 } | 1147 } |
| 1147 int num_loads; | 1148 int num_loads; |
| 1148 if (!args->GetInteger("num_loads", &num_loads)) { | 1149 if (!args->GetInteger("num_loads", &num_loads)) { |
| 1149 AutomationJSONReply(this, reply_message).SendError( | 1150 AutomationJSONReply(this, reply_message).SendError( |
| 1150 "Invalid or missing arg: 'num_loads'"); | 1151 "Invalid or missing arg: 'num_loads'"); |
| 1151 return; | 1152 return; |
| 1152 } | 1153 } |
| 1153 new BrowserOpenedWithExistingProfileNotificationObserver( | 1154 new BrowserOpenedWithExistingProfileNotificationObserver( |
| 1154 this, reply_message, num_loads); | 1155 this, reply_message, num_loads); |
| 1155 ProfileManager::FindOrCreateNewWindowForProfile( | 1156 profiles::FindOrCreateNewWindowForProfile( |
| 1156 profile, | 1157 profile, |
| 1157 chrome::startup::IS_NOT_PROCESS_STARTUP, | 1158 chrome::startup::IS_NOT_PROCESS_STARTUP, |
| 1158 chrome::startup::IS_NOT_FIRST_RUN, | 1159 chrome::startup::IS_NOT_FIRST_RUN, |
| 1159 chrome::HOST_DESKTOP_TYPE_NATIVE, | 1160 chrome::HOST_DESKTOP_TYPE_NATIVE, |
| 1160 false); | 1161 false); |
| 1161 } | 1162 } |
| 1162 | 1163 |
| 1163 void TestingAutomationProvider::GetWindowForBrowser(int browser_handle, | 1164 void TestingAutomationProvider::GetWindowForBrowser(int browser_handle, |
| 1164 bool* success, | 1165 bool* success, |
| 1165 int* handle) { | 1166 int* handle) { |
| (...skipping 4435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5601 if (g_browser_process) | 5602 if (g_browser_process) |
| 5602 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 5603 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 5603 } | 5604 } |
| 5604 | 5605 |
| 5605 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 5606 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
| 5606 WebContents* tab) { | 5607 WebContents* tab) { |
| 5607 TabStripModel* tab_strip = browser->tab_strip_model(); | 5608 TabStripModel* tab_strip = browser->tab_strip_model(); |
| 5608 if (tab_strip->GetActiveWebContents() != tab) | 5609 if (tab_strip->GetActiveWebContents() != tab) |
| 5609 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 5610 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
| 5610 } | 5611 } |
| OLD | NEW |