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

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

Issue 12386019: Instant: Use only one hidden WebContents per profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months 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
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 "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 RegisterTitle(values, "spellingConfirmOverlay", 400 RegisterTitle(values, "spellingConfirmOverlay",
401 IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE); 401 IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE);
402 RegisterCloudPrintValues(values); 402 RegisterCloudPrintValues(values);
403 403
404 values->SetString("syncLearnMoreURL", chrome::kSyncLearnMoreURL); 404 values->SetString("syncLearnMoreURL", chrome::kSyncLearnMoreURL);
405 string16 omnibox_url = ASCIIToUTF16(chrome::kOmniboxLearnMoreURL); 405 string16 omnibox_url = ASCIIToUTF16(chrome::kOmniboxLearnMoreURL);
406 values->SetString( 406 values->SetString(
407 "defaultSearchGroupLabel", 407 "defaultSearchGroupLabel",
408 l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url)); 408 l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url));
409 409
410 std::string instant_pref_name =
411 chrome::search::GetInstantPrefName(Profile::FromWebUI(web_ui()));
412 int instant_message_id = instant_pref_name == prefs::kInstantEnabled ?
413 IDS_INSTANT_PREF_WITH_WARNING : IDS_INSTANT_EXTENDED_PREF_WITH_WARNING;
410 string16 instant_learn_more_url = ASCIIToUTF16(chrome::kInstantLearnMoreURL); 414 string16 instant_learn_more_url = ASCIIToUTF16(chrome::kInstantLearnMoreURL);
411 int instant_message_id = IDS_INSTANT_PREF_WITH_WARNING; 415 values->SetString("instant_enabled", instant_pref_name);
412 if (chrome::search::IsInstantExtendedAPIEnabled(
413 Profile::FromWebUI(web_ui()))) {
414 instant_message_id = IDS_INSTANT_EXTENDED_PREF_WITH_WARNING;
415 values->SetString("instant_enabled", "instant_extended.enabled");
416 } else {
417 values->SetString("instant_enabled", "instant.enabled");
418 }
419 values->SetString( 416 values->SetString(
420 "instantPrefAndWarning", 417 "instantPrefAndWarning",
421 l10n_util::GetStringFUTF16(instant_message_id, instant_learn_more_url)); 418 l10n_util::GetStringFUTF16(instant_message_id, instant_learn_more_url));
422 values->SetString("instantLearnMoreLink", instant_learn_more_url); 419 values->SetString("instantLearnMoreLink", instant_learn_more_url);
423 420
424 #if defined(OS_CHROMEOS) 421 #if defined(OS_CHROMEOS)
425 const chromeos::User* user = chromeos::UserManager::Get()->GetLoggedInUser(); 422 const chromeos::User* user = chromeos::UserManager::Get()->GetLoggedInUser();
426 values->SetString("username", user ? user->email() : std::string()); 423 values->SetString("username", user ? user->email() : std::string());
427 #endif 424 #endif
428 425
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 981
985 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { 982 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) {
986 DictionaryValue* profile_value = new DictionaryValue(); 983 DictionaryValue* profile_value = new DictionaryValue();
987 profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); 984 profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i));
988 base::FilePath profile_path = cache.GetPathOfProfileAtIndex(i); 985 base::FilePath profile_path = cache.GetPathOfProfileAtIndex(i);
989 profile_value->Set("filePath", base::CreateFilePathValue(profile_path)); 986 profile_value->Set("filePath", base::CreateFilePathValue(profile_path));
990 profile_value->SetBoolean("isCurrentProfile", 987 profile_value->SetBoolean("isCurrentProfile",
991 profile_path == current_profile_path); 988 profile_path == current_profile_path);
992 profile_value->SetBoolean("isManaged", cache.ProfileIsManagedAtIndex(i)); 989 profile_value->SetBoolean("isManaged", cache.ProfileIsManagedAtIndex(i));
993 990
994
995 bool is_gaia_picture = 991 bool is_gaia_picture =
996 cache.IsUsingGAIAPictureOfProfileAtIndex(i) && 992 cache.IsUsingGAIAPictureOfProfileAtIndex(i) &&
997 cache.GetGAIAPictureOfProfileAtIndex(i); 993 cache.GetGAIAPictureOfProfileAtIndex(i);
998 if (is_gaia_picture) { 994 if (is_gaia_picture) {
999 gfx::Image icon = profiles::GetAvatarIconForWebUI( 995 gfx::Image icon = profiles::GetAvatarIconForWebUI(
1000 cache.GetAvatarIconOfProfileAtIndex(i), true); 996 cache.GetAvatarIconOfProfileAtIndex(i), true);
1001 profile_value->SetString("iconURL", 997 profile_value->SetString("iconURL",
1002 webui::GetBitmapDataUrl(icon.AsBitmap())); 998 webui::GetBitmapDataUrl(icon.AsBitmap()));
1003 } else { 999 } else {
1004 size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i); 1000 size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i);
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 base::FundamentalValue disabled(proxy_prefs_.IsManaged() || 1456 base::FundamentalValue disabled(proxy_prefs_.IsManaged() ||
1461 is_extension_controlled); 1457 is_extension_controlled);
1462 base::FundamentalValue extension_controlled(is_extension_controlled); 1458 base::FundamentalValue extension_controlled(is_extension_controlled);
1463 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", 1459 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection",
1464 disabled, extension_controlled); 1460 disabled, extension_controlled);
1465 1461
1466 #endif // !defined(OS_CHROMEOS) 1462 #endif // !defined(OS_CHROMEOS)
1467 } 1463 }
1468 1464
1469 } // namespace options 1465 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698