| 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/flags_ui.h" | 5 #include "chrome/browser/ui/webui/flags_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "content/browser/tab_contents/tab_contents.h" | 22 #include "content/browser/tab_contents/tab_contents.h" |
| 23 #include "grit/browser_resources.h" | 23 #include "grit/browser_resources.h" |
| 24 #include "grit/chromium_strings.h" | 24 #include "grit/chromium_strings.h" |
| 25 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 26 #include "grit/theme_resources_standard.h" | 26 #include "grit/theme_resources_standard.h" |
| 27 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 30 | 30 |
| 31 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
| 32 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 32 #include "chrome/browser/chromeos/cros_settings.h" |
| 33 #include "chrome/browser/chromeos/login/user_manager.h" | 33 #include "chrome/browser/chromeos/login/user_manager.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 ChromeWebUIDataSource* CreateFlagsUIHTMLSource() { | 38 ChromeWebUIDataSource* CreateFlagsUIHTMLSource() { |
| 39 ChromeWebUIDataSource* source = | 39 ChromeWebUIDataSource* source = |
| 40 new ChromeWebUIDataSource(chrome::kChromeUIFlagsHost); | 40 new ChromeWebUIDataSource(chrome::kChromeUIFlagsHost); |
| 41 | 41 |
| 42 source->AddLocalizedString("flagsLongTitle", IDS_FLAGS_LONG_TITLE); | 42 source->AddLocalizedString("flagsLongTitle", IDS_FLAGS_LONG_TITLE); |
| 43 source->AddLocalizedString("flagsTableTitle", IDS_FLAGS_TABLE_TITLE); | 43 source->AddLocalizedString("flagsTableTitle", IDS_FLAGS_TABLE_TITLE); |
| 44 source->AddLocalizedString("flagsNoExperimentsAvailable", | 44 source->AddLocalizedString("flagsNoExperimentsAvailable", |
| 45 IDS_FLAGS_NO_EXPERIMENTS_AVAILABLE); | 45 IDS_FLAGS_NO_EXPERIMENTS_AVAILABLE); |
| 46 source->AddLocalizedString("flagsWarningHeader", IDS_FLAGS_WARNING_HEADER); | 46 source->AddLocalizedString("flagsWarningHeader", IDS_FLAGS_WARNING_HEADER); |
| 47 source->AddLocalizedString("flagsBlurb", IDS_FLAGS_WARNING_TEXT); | 47 source->AddLocalizedString("flagsBlurb", IDS_FLAGS_WARNING_TEXT); |
| 48 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
| 49 int ids = IDS_PRODUCT_OS_NAME; | 49 int ids = IDS_PRODUCT_OS_NAME; |
| 50 #else | 50 #else |
| 51 int ids = IDS_PRODUCT_NAME; | 51 int ids = IDS_PRODUCT_NAME; |
| 52 #endif | 52 #endif |
| 53 source->AddString("flagsRestartNotice", l10n_util::GetStringFUTF16( | 53 source->AddString("flagsRestartNotice", l10n_util::GetStringFUTF16( |
| 54 IDS_FLAGS_RELAUNCH_NOTICE, l10n_util::GetStringUTF16(ids))); | 54 IDS_FLAGS_RELAUNCH_NOTICE, l10n_util::GetStringUTF16(ids))); |
| 55 source->AddLocalizedString("flagsRestartButton", IDS_FLAGS_RELAUNCH_BUTTON); | 55 source->AddLocalizedString("flagsRestartButton", IDS_FLAGS_RELAUNCH_BUTTON); |
| 56 source->AddLocalizedString("disable", IDS_FLAGS_DISABLE); | 56 source->AddLocalizedString("disable", IDS_FLAGS_DISABLE); |
| 57 source->AddLocalizedString("enable", IDS_FLAGS_ENABLE); | 57 source->AddLocalizedString("enable", IDS_FLAGS_ENABLE); |
| 58 #if defined(OS_CHROMEOS) | 58 #if defined(OS_CHROMEOS) |
| 59 // Set the strings to show which user can actually change the flags | 59 // Set the strings to show which user can actually change the flags |
| 60 source->AddLocalizedString("ownerOnly", IDS_OPTIONS_ACCOUNTS_OWNER_ONLY); | 60 source->AddLocalizedString("ownerOnly", IDS_OPTIONS_ACCOUNTS_OWNER_ONLY); |
| 61 source->AddString("ownerUserId", UTF8ToUTF16( | 61 std::string owner; |
| 62 chromeos::UserCrosSettingsProvider::cached_owner())); | 62 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); |
| 63 source->AddString("ownerUserId", UTF8ToUTF16(owner)); |
| 63 #endif | 64 #endif |
| 64 | 65 |
| 65 source->set_json_path("strings.js"); | 66 source->set_json_path("strings.js"); |
| 66 source->add_resource_path("flags.js", IDR_FLAGS_JS); | 67 source->add_resource_path("flags.js", IDR_FLAGS_JS); |
| 67 | 68 |
| 68 int idr = IDR_FLAGS_HTML; | 69 int idr = IDR_FLAGS_HTML; |
| 69 #if defined (OS_CHROMEOS) | 70 #if defined (OS_CHROMEOS) |
| 70 if (!chromeos::UserManager::Get()->current_user_is_owner()) | 71 if (!chromeos::UserManager::Get()->current_user_is_owner()) |
| 71 idr = IDR_FLAGS_HTML_WARNING; | 72 idr = IDR_FLAGS_HTML_WARNING; |
| 72 #endif | 73 #endif |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // static | 163 // static |
| 163 RefCountedMemory* FlagsUI::GetFaviconResourceBytes() { | 164 RefCountedMemory* FlagsUI::GetFaviconResourceBytes() { |
| 164 return ResourceBundle::GetSharedInstance(). | 165 return ResourceBundle::GetSharedInstance(). |
| 165 LoadDataResourceBytes(IDR_FLAGS); | 166 LoadDataResourceBytes(IDR_FLAGS); |
| 166 } | 167 } |
| 167 | 168 |
| 168 // static | 169 // static |
| 169 void FlagsUI::RegisterPrefs(PrefService* prefs) { | 170 void FlagsUI::RegisterPrefs(PrefService* prefs) { |
| 170 prefs->RegisterListPref(prefs::kEnabledLabsExperiments); | 171 prefs->RegisterListPref(prefs::kEnabledLabsExperiments); |
| 171 } | 172 } |
| OLD | NEW |