| OLD | NEW |
| 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/ui/webui/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "chrome/browser/search_engines/template_url_service.h" | 38 #include "chrome/browser/search_engines/template_url_service.h" |
| 39 #include "chrome/browser/search_engines/template_url_service_factory.h" | 39 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 40 #include "chrome/browser/service/service_process_control.h" | 40 #include "chrome/browser/service/service_process_control.h" |
| 41 #include "chrome/browser/signin/signin_manager.h" | 41 #include "chrome/browser/signin/signin_manager.h" |
| 42 #include "chrome/browser/signin/signin_manager_factory.h" | 42 #include "chrome/browser/signin/signin_manager_factory.h" |
| 43 #include "chrome/browser/sync/profile_sync_service.h" | 43 #include "chrome/browser/sync/profile_sync_service.h" |
| 44 #include "chrome/browser/sync/profile_sync_service_factory.h" | 44 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 45 #include "chrome/browser/sync/sync_ui_util.h" | 45 #include "chrome/browser/sync/sync_ui_util.h" |
| 46 #include "chrome/browser/themes/theme_service.h" | 46 #include "chrome/browser/themes/theme_service.h" |
| 47 #include "chrome/browser/themes/theme_service_factory.h" | 47 #include "chrome/browser/themes/theme_service_factory.h" |
| 48 #include "chrome/browser/ui/browser_finder.h" |
| 48 #include "chrome/browser/ui/chrome_select_file_policy.h" | 49 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 50 #include "chrome/browser/ui/host_desktop.h" |
| 51 #include "chrome/browser/ui/options/options_util.h" |
| 49 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 52 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 50 #include "chrome/browser/ui/webui/favicon_source.h" | 53 #include "chrome/browser/ui/webui/favicon_source.h" |
| 51 #include "chrome/browser/ui/webui/web_ui_util.h" | 54 #include "chrome/browser/ui/webui/web_ui_util.h" |
| 52 #include "chrome/common/chrome_constants.h" | 55 #include "chrome/common/chrome_constants.h" |
| 53 #include "chrome/common/chrome_notification_types.h" | 56 #include "chrome/common/chrome_notification_types.h" |
| 54 #include "chrome/common/chrome_paths.h" | 57 #include "chrome/common/chrome_paths.h" |
| 55 #include "chrome/common/chrome_switches.h" | 58 #include "chrome/common/chrome_switches.h" |
| 56 #include "chrome/common/pref_names.h" | 59 #include "chrome/common/pref_names.h" |
| 57 #include "chrome/common/url_constants.h" | 60 #include "chrome/common/url_constants.h" |
| 58 #include "content/public/browser/browser_thread.h" | 61 #include "content/public/browser/browser_thread.h" |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 *GetProfilesInfoList()); | 944 *GetProfilesInfoList()); |
| 942 } | 945 } |
| 943 | 946 |
| 944 void BrowserOptionsHandler::CreateProfile(const ListValue* args) { | 947 void BrowserOptionsHandler::CreateProfile(const ListValue* args) { |
| 945 // This handler could have been called in managed mode, for example because | 948 // This handler could have been called in managed mode, for example because |
| 946 // the user fiddled with the web inspector. Silently return in this case. | 949 // the user fiddled with the web inspector. Silently return in this case. |
| 947 if (!ProfileManager::IsMultipleProfilesEnabled()) | 950 if (!ProfileManager::IsMultipleProfilesEnabled()) |
| 948 return; | 951 return; |
| 949 string16 name, icon; | 952 string16 name, icon; |
| 950 bool create_box_checked; | 953 bool create_box_checked; |
| 954 |
| 955 Browser* browser = |
| 956 browser::FindBrowserWithWebContents(web_ui()->GetWebContents()); |
| 957 chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; |
| 958 if (browser) |
| 959 desktop_type = browser->host_desktop_type(); |
| 960 |
| 951 if (args->GetString(0, &name) && args->GetString(1, &icon)) { | 961 if (args->GetString(0, &name) && args->GetString(1, &icon)) { |
| 952 if (args->GetBoolean(2, &create_box_checked) && create_box_checked) { | 962 if (args->GetBoolean(2, &create_box_checked) && create_box_checked) { |
| 953 ProfileManager::CreateMultiProfileAsync( | 963 ProfileManager::CreateMultiProfileAsync( |
| 954 name, icon, base::Bind(&CreateDesktopShortcutForProfile)); | 964 name, icon, base::Bind(&CreateDesktopShortcutForProfile), desktop_type); |
| 955 } else { | 965 } else { |
| 956 ProfileManager::CreateMultiProfileAsync( | 966 ProfileManager::CreateMultiProfileAsync( |
| 957 name, icon, ProfileManager::CreateCallback()); | 967 name, icon, ProfileManager::CreateCallback(), desktop_type); |
| 958 } | 968 } |
| 959 } else { | 969 } else { |
| 960 ProfileManager::CreateMultiProfileAsync( | 970 ProfileManager::CreateMultiProfileAsync( |
| 961 string16(), string16(), ProfileManager::CreateCallback()); | 971 string16(), string16(), ProfileManager::CreateCallback(), desktop_type); |
| 962 } | 972 } |
| 963 } | 973 } |
| 964 | 974 |
| 965 void BrowserOptionsHandler::CreateProfileInfo(const ListValue* args) { | 975 void BrowserOptionsHandler::CreateProfileInfo(const ListValue* args) { |
| 966 DictionaryValue* profile_info = new DictionaryValue(); | 976 DictionaryValue* profile_info = new DictionaryValue(); |
| 967 ProfileInfoCache& cache = | 977 ProfileInfoCache& cache = |
| 968 g_browser_process->profile_manager()->GetProfileInfoCache(); | 978 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 969 | 979 |
| 970 size_t icon_index = cache.ChooseAvatarIconIndexForNewProfile(); | 980 size_t icon_index = cache.ChooseAvatarIconIndexForNewProfile(); |
| 971 | 981 |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 1403 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 1394 } | 1404 } |
| 1395 StringValue label(label_str); | 1405 StringValue label(label_str); |
| 1396 | 1406 |
| 1397 web_ui()->CallJavascriptFunction( | 1407 web_ui()->CallJavascriptFunction( |
| 1398 "BrowserOptions.setupProxySettingsSection", disabled, label); | 1408 "BrowserOptions.setupProxySettingsSection", disabled, label); |
| 1399 #endif // !defined(OS_CHROMEOS) | 1409 #endif // !defined(OS_CHROMEOS) |
| 1400 } | 1410 } |
| 1401 | 1411 |
| 1402 } // namespace options | 1412 } // namespace options |
| OLD | NEW |