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 "apps/shell_window.h" | 10 #include "apps/shell_window.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 #include "content/public/browser/navigation_controller.h" | 73 #include "content/public/browser/navigation_controller.h" |
74 #include "content/public/browser/notification_details.h" | 74 #include "content/public/browser/notification_details.h" |
75 #include "content/public/browser/notification_service.h" | 75 #include "content/public/browser/notification_service.h" |
76 #include "content/public/browser/notification_source.h" | 76 #include "content/public/browser/notification_source.h" |
77 #include "content/public/browser/notification_types.h" | 77 #include "content/public/browser/notification_types.h" |
78 #include "content/public/browser/url_data_source.h" | 78 #include "content/public/browser/url_data_source.h" |
79 #include "content/public/browser/user_metrics.h" | 79 #include "content/public/browser/user_metrics.h" |
80 #include "content/public/browser/web_contents.h" | 80 #include "content/public/browser/web_contents.h" |
81 #include "content/public/browser/web_contents_view.h" | 81 #include "content/public/browser/web_contents_view.h" |
82 #include "content/public/common/page_zoom.h" | 82 #include "content/public/common/page_zoom.h" |
| 83 #include "google_apis/gaia/gaia_auth_util.h" |
83 #include "google_apis/gaia/google_service_auth_error.h" | 84 #include "google_apis/gaia/google_service_auth_error.h" |
84 #include "grit/chromium_strings.h" | 85 #include "grit/chromium_strings.h" |
85 #include "grit/generated_resources.h" | 86 #include "grit/generated_resources.h" |
86 #include "grit/locale_settings.h" | 87 #include "grit/locale_settings.h" |
87 #include "grit/theme_resources.h" | 88 #include "grit/theme_resources.h" |
88 #include "third_party/skia/include/core/SkBitmap.h" | 89 #include "third_party/skia/include/core/SkBitmap.h" |
89 #include "ui/base/l10n/l10n_util.h" | 90 #include "ui/base/l10n/l10n_util.h" |
90 #include "ui/base/webui/web_ui_util.h" | 91 #include "ui/base/webui/web_ui_util.h" |
91 | 92 |
92 #if !defined(OS_CHROMEOS) | 93 #if !defined(OS_CHROMEOS) |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 RegisterCloudPrintValues(values); | 461 RegisterCloudPrintValues(values); |
461 #endif | 462 #endif |
462 | 463 |
463 values->SetString("syncLearnMoreURL", chrome::kSyncLearnMoreURL); | 464 values->SetString("syncLearnMoreURL", chrome::kSyncLearnMoreURL); |
464 string16 omnibox_url = ASCIIToUTF16(chrome::kOmniboxLearnMoreURL); | 465 string16 omnibox_url = ASCIIToUTF16(chrome::kOmniboxLearnMoreURL); |
465 values->SetString( | 466 values->SetString( |
466 "defaultSearchGroupLabel", | 467 "defaultSearchGroupLabel", |
467 l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url)); | 468 l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url)); |
468 | 469 |
469 #if defined(OS_CHROMEOS) | 470 #if defined(OS_CHROMEOS) |
470 const chromeos::User* user = chromeos::UserManager::Get()->GetLoggedInUser(); | 471 Profile* profile = Profile::FromWebUI(web_ui()); |
471 values->SetString("username", user ? user->email() : std::string()); | 472 std::string name = profile->GetProfileName(); |
| 473 std::string username = |
| 474 name.empty() ? name : gaia::SanitizeEmail(gaia::CanonicalizeEmail(name)); |
| 475 values->SetString("username", username); |
472 #endif | 476 #endif |
473 | 477 |
474 // Pass along sync status early so it will be available during page init. | 478 // Pass along sync status early so it will be available during page init. |
475 values->Set("syncData", GetSyncStateDictionary().release()); | 479 values->Set("syncData", GetSyncStateDictionary().release()); |
476 | 480 |
477 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); | 481 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); |
478 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL); | 482 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL); |
479 | 483 |
480 #if defined(OS_CHROMEOS) | 484 #if defined(OS_CHROMEOS) |
481 // TODO(pastarmovj): replace this with a call to the CrosSettings list | 485 // TODO(pastarmovj): replace this with a call to the CrosSettings list |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 void BrowserOptionsHandler::SetupManagingSupervisedUsers() { | 1583 void BrowserOptionsHandler::SetupManagingSupervisedUsers() { |
1580 bool has_users = !Profile::FromWebUI(web_ui())-> | 1584 bool has_users = !Profile::FromWebUI(web_ui())-> |
1581 GetPrefs()->GetDictionary(prefs::kManagedUsers)->empty(); | 1585 GetPrefs()->GetDictionary(prefs::kManagedUsers)->empty(); |
1582 base::FundamentalValue has_users_value(has_users); | 1586 base::FundamentalValue has_users_value(has_users); |
1583 web_ui()->CallJavascriptFunction( | 1587 web_ui()->CallJavascriptFunction( |
1584 "BrowserOptions.updateManagesSupervisedUsers", | 1588 "BrowserOptions.updateManagesSupervisedUsers", |
1585 has_users_value); | 1589 has_users_value); |
1586 } | 1590 } |
1587 | 1591 |
1588 } // namespace options | 1592 } // namespace options |
OLD | NEW |