| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/options2/personal_options_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/personal_options_handler2.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/sync/sync_setup_flow.h" | 26 #include "chrome/browser/sync/sync_setup_flow.h" |
| 27 #include "chrome/browser/sync/sync_ui_util.h" | 27 #include "chrome/browser/sync/sync_ui_util.h" |
| 28 #include "chrome/browser/themes/theme_service.h" | 28 #include "chrome/browser/themes/theme_service.h" |
| 29 #include "chrome/browser/themes/theme_service_factory.h" | 29 #include "chrome/browser/themes/theme_service_factory.h" |
| 30 #include "chrome/browser/ui/webui/web_ui_util.h" | 30 #include "chrome/browser/ui/webui/web_ui_util.h" |
| 31 #include "chrome/common/chrome_notification_types.h" | 31 #include "chrome/common/chrome_notification_types.h" |
| 32 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
| 33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/common/net/gaia/google_service_auth_error.h" | 34 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 35 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
| 36 #include "content/browser/tab_contents/tab_contents.h" | 36 #include "content/browser/tab_contents/navigation_controller.h" |
| 37 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
| 38 #include "content/public/browser/user_metrics.h" | 38 #include "content/public/browser/user_metrics.h" |
| 39 #include "content/public/browser/web_contents.h" |
| 39 #include "grit/chromium_strings.h" | 40 #include "grit/chromium_strings.h" |
| 40 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
| 41 #include "grit/locale_settings.h" | 42 #include "grit/locale_settings.h" |
| 42 #include "grit/theme_resources.h" | 43 #include "grit/theme_resources.h" |
| 43 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
| 44 | 45 |
| 45 #if defined(OS_CHROMEOS) | 46 #if defined(OS_CHROMEOS) |
| 46 #include "chrome/browser/chromeos/login/user_manager.h" | 47 #include "chrome/browser/chromeos/login/user_manager.h" |
| 47 #include "chrome/browser/chromeos/options/take_photo_dialog.h" | 48 #include "chrome/browser/chromeos/options/take_photo_dialog.h" |
| 48 #include "chrome/browser/ui/browser_window.h" | 49 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 email_value); | 405 email_value); |
| 405 } | 406 } |
| 406 } | 407 } |
| 407 #endif | 408 #endif |
| 408 | 409 |
| 409 void PersonalOptionsHandler::SendProfilesInfo() { | 410 void PersonalOptionsHandler::SendProfilesInfo() { |
| 410 ProfileInfoCache& cache = | 411 ProfileInfoCache& cache = |
| 411 g_browser_process->profile_manager()->GetProfileInfoCache(); | 412 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 412 ListValue profile_info_list; | 413 ListValue profile_info_list; |
| 413 FilePath current_profile_path = | 414 FilePath current_profile_path = |
| 414 web_ui()->tab_contents()->GetBrowserContext()->GetPath(); | 415 web_ui()->web_contents()->GetBrowserContext()->GetPath(); |
| 415 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { | 416 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { |
| 416 DictionaryValue* profile_value = new DictionaryValue(); | 417 DictionaryValue* profile_value = new DictionaryValue(); |
| 417 FilePath profile_path = cache.GetPathOfProfileAtIndex(i); | 418 FilePath profile_path = cache.GetPathOfProfileAtIndex(i); |
| 418 profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); | 419 profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); |
| 419 profile_value->Set("filePath", base::CreateFilePathValue(profile_path)); | 420 profile_value->Set("filePath", base::CreateFilePathValue(profile_path)); |
| 420 profile_value->SetBoolean("isCurrentProfile", | 421 profile_value->SetBoolean("isCurrentProfile", |
| 421 profile_path == current_profile_path); | 422 profile_path == current_profile_path); |
| 422 | 423 |
| 423 bool is_gaia_picture = | 424 bool is_gaia_picture = |
| 424 cache.IsUsingGAIAPictureOfProfileAtIndex(i) && | 425 cache.IsUsingGAIAPictureOfProfileAtIndex(i) && |
| (...skipping 13 matching lines...) Expand all Loading... |
| 438 | 439 |
| 439 web_ui()->CallJavascriptFunction("PersonalOptions.setProfilesInfo", | 440 web_ui()->CallJavascriptFunction("PersonalOptions.setProfilesInfo", |
| 440 profile_info_list); | 441 profile_info_list); |
| 441 } | 442 } |
| 442 | 443 |
| 443 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { | 444 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { |
| 444 ProfileManager::CreateMultiProfileAsync(); | 445 ProfileManager::CreateMultiProfileAsync(); |
| 445 } | 446 } |
| 446 | 447 |
| 447 } // namespace options2 | 448 } // namespace options2 |
| OLD | NEW |