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