Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 60443002: Fixing problem with user image in settings page when page gets called as visiting window on a multi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: As discussed - for security added empty check Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 values->SetString("username", name.empty() ? name :
James Hawkins 2013/11/05 18:51:44 Optional nit: Might be more readable to the latter
Mr4D (OOO till 08-26) 2013/11/05 19:07:08 Not quite sure if it is better readable, but done.
474 gaia::SanitizeEmail(gaia::CanonicalizeEmail(name)));
472 #endif 475 #endif
473 476
474 // Pass along sync status early so it will be available during page init. 477 // Pass along sync status early so it will be available during page init.
475 values->Set("syncData", GetSyncStateDictionary().release()); 478 values->Set("syncData", GetSyncStateDictionary().release());
476 479
477 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); 480 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL);
478 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL); 481 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL);
479 482
480 #if defined(OS_CHROMEOS) 483 #if defined(OS_CHROMEOS)
481 // TODO(pastarmovj): replace this with a call to the CrosSettings list 484 // TODO(pastarmovj): replace this with a call to the CrosSettings list
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 void BrowserOptionsHandler::SetupManagingSupervisedUsers() { 1582 void BrowserOptionsHandler::SetupManagingSupervisedUsers() {
1580 bool has_users = !Profile::FromWebUI(web_ui())-> 1583 bool has_users = !Profile::FromWebUI(web_ui())->
1581 GetPrefs()->GetDictionary(prefs::kManagedUsers)->empty(); 1584 GetPrefs()->GetDictionary(prefs::kManagedUsers)->empty();
1582 base::FundamentalValue has_users_value(has_users); 1585 base::FundamentalValue has_users_value(has_users);
1583 web_ui()->CallJavascriptFunction( 1586 web_ui()->CallJavascriptFunction(
1584 "BrowserOptions.updateManagesSupervisedUsers", 1587 "BrowserOptions.updateManagesSupervisedUsers",
1585 has_users_value); 1588 has_users_value);
1586 } 1589 }
1587 1590
1588 } // namespace options 1591 } // namespace options
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698