| 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/options/personal_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/personal_options_handler.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" | |
| 37 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
| 38 #include "content/public/browser/user_metrics.h" | 37 #include "content/public/browser/user_metrics.h" |
| 38 #include "content/public/browser/web_contents.h" |
| 39 #include "grit/chromium_strings.h" | 39 #include "grit/chromium_strings.h" |
| 40 #include "grit/generated_resources.h" | 40 #include "grit/generated_resources.h" |
| 41 #include "grit/locale_settings.h" | 41 #include "grit/locale_settings.h" |
| 42 #include "grit/theme_resources.h" | 42 #include "grit/theme_resources.h" |
| 43 #include "ui/base/l10n/l10n_util.h" | 43 #include "ui/base/l10n/l10n_util.h" |
| 44 | 44 |
| 45 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
| 46 #include "chrome/browser/chromeos/login/user_manager.h" | 46 #include "chrome/browser/chromeos/login/user_manager.h" |
| 47 #include "chrome/browser/chromeos/options/take_photo_dialog.h" | 47 #include "chrome/browser/chromeos/options/take_photo_dialog.h" |
| 48 #include "chrome/browser/ui/browser_window.h" | 48 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 email_value); | 402 email_value); |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 #endif | 405 #endif |
| 406 | 406 |
| 407 void PersonalOptionsHandler::SendProfilesInfo() { | 407 void PersonalOptionsHandler::SendProfilesInfo() { |
| 408 ProfileInfoCache& cache = | 408 ProfileInfoCache& cache = |
| 409 g_browser_process->profile_manager()->GetProfileInfoCache(); | 409 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 410 ListValue profile_info_list; | 410 ListValue profile_info_list; |
| 411 FilePath current_profile_path = | 411 FilePath current_profile_path = |
| 412 web_ui()->tab_contents()->GetBrowserContext()->GetPath(); | 412 web_ui()->web_contents()->GetBrowserContext()->GetPath(); |
| 413 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { | 413 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { |
| 414 DictionaryValue* profile_value = new DictionaryValue(); | 414 DictionaryValue* profile_value = new DictionaryValue(); |
| 415 FilePath profile_path = cache.GetPathOfProfileAtIndex(i); | 415 FilePath profile_path = cache.GetPathOfProfileAtIndex(i); |
| 416 profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); | 416 profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); |
| 417 profile_value->Set("filePath", base::CreateFilePathValue(profile_path)); | 417 profile_value->Set("filePath", base::CreateFilePathValue(profile_path)); |
| 418 profile_value->SetBoolean("isCurrentProfile", | 418 profile_value->SetBoolean("isCurrentProfile", |
| 419 profile_path == current_profile_path); | 419 profile_path == current_profile_path); |
| 420 | 420 |
| 421 bool is_gaia_picture = | 421 bool is_gaia_picture = |
| 422 cache.IsUsingGAIAPictureOfProfileAtIndex(i) && | 422 cache.IsUsingGAIAPictureOfProfileAtIndex(i) && |
| (...skipping 11 matching lines...) Expand all Loading... |
| 434 profile_info_list.Append(profile_value); | 434 profile_info_list.Append(profile_value); |
| 435 } | 435 } |
| 436 | 436 |
| 437 web_ui()->CallJavascriptFunction("PersonalOptions.setProfilesInfo", | 437 web_ui()->CallJavascriptFunction("PersonalOptions.setProfilesInfo", |
| 438 profile_info_list); | 438 profile_info_list); |
| 439 } | 439 } |
| 440 | 440 |
| 441 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { | 441 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { |
| 442 ProfileManager::CreateMultiProfileAsync(); | 442 ProfileManager::CreateMultiProfileAsync(); |
| 443 } | 443 } |
| OLD | NEW |