diff options
author | achuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 19:21:49 +0000 |
---|---|---|
committer | achuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 19:21:49 +0000 |
commit | 3cbae79b076f6cff6fcacbae93e87f5872a11c58 (patch) | |
tree | ce03cf4a293e7bb31f1fa93cf3176f0f4ada9cef /chrome | |
parent | 13f3f595723af07d2de2fb184157fffaefa5a438 (diff) | |
download | chromium_src-3cbae79b076f6cff6fcacbae93e87f5872a11c58.zip chromium_src-3cbae79b076f6cff6fcacbae93e87f5872a11c58.tar.gz chromium_src-3cbae79b076f6cff6fcacbae93e87f5872a11c58.tar.bz2 |
Add gdata-related enterprise policy preferences.
* Add preferences kDisableGData, kDisableGDataOverCellular, kDisableGDataHostedFiles, and register/handle these.
* CommandLinePrefStore is used to set kDisableGData preference based on switch.
* Add GDataDisabled and GDataDisabledOverCellular to policy template, add to simple pref-policy handler list.
* Cros specific tests for new gdata policies.
BUG=chromium-os:27168
TEST=--disable-gdata works as expected. GDataDisabled in /etc/chromium/policies/managed/test_policy.json works as expected.
Review URL: https://chromiumcodereview.appspot.com/9719008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/policy/policy_templates.json | 38 | ||||
-rw-r--r-- | chrome/browser/chromeos/extensions/file_browser_private_api.cc | 11 | ||||
-rw-r--r-- | chrome/browser/chromeos/preferences.cc | 14 | ||||
-rw-r--r-- | chrome/browser/chromeos/preferences.h | 5 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_handler_list.cc | 6 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store_unittest.cc | 9 | ||||
-rw-r--r-- | chrome/browser/prefs/command_line_pref_store.cc | 3 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 9 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 3 | ||||
-rwxr-xr-x | chrome/test/functional/policy_test_cases.py | 2 |
10 files changed, 91 insertions, 9 deletions
diff --git a/chrome/app/policy/policy_templates.json b/chrome/app/policy/policy_templates.json index fc4d10e..54abdd6 100644 --- a/chrome/app/policy/policy_templates.json +++ b/chrome/app/policy/policy_templates.json @@ -112,7 +112,7 @@ # persistent IDs for all fields (but not for groups!) are needed. These are # specified by the 'id' keys of each policy. NEVER CHANGE EXISTING IDs, # because doing so would break the deployed wire format! -# For your editing convenience: highest ID currently used: 138 +# For your editing convenience: highest ID currently used: 140 # # Placeholders: # The following placeholder strings are automatically substituted: @@ -2556,6 +2556,42 @@ If this policy is left unset, background mode is initially disabled and can be controlled by the user in the browser settings.''', }, + { + 'name': 'GData', + 'type': 'group', + 'caption': '''Configure GData options''', + 'desc': '''Configure GData in <ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph>.''', + 'policies': [ + { + 'name': 'GDataDisabled', + 'type': 'main', + 'supported_on': ['chrome_os:19-'], + 'features': {'dynamic_refresh': True}, + 'example_value': True, + 'id': 139, + 'caption': '''Disables GData''', + 'desc': '''Disables Google Docs syncing when set to True. + + - i.e. no data is uploaded to Google Docs. + + - if not set or false, users will be able to transfer files to Google Docs.''', + }, + { + 'name': 'GDataDisabledOverCellular', + 'type': 'main', + 'supported_on': ['chrome_os:19-'], + 'features': {'dynamic_refresh': True}, + 'example_value': True, + 'id': 140, + 'caption': '''Disables GData over Cellular connections''', + 'desc': '''Disables Google Docs syncing when using a cellular connection when set to True. + + - i.e. data is only synced to Google Docs when connected via WiFi or Ethernet. + + - if not set or false, users will be able to transfer files to Google Docs via cellular connections.''', + }, + ], + }, ], 'messages': { # Messages that are not associated to any policies. diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc index 858d649..349b00d 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc @@ -4,9 +4,10 @@ #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" +#include <utility> + #include "base/base64.h" #include "base/bind.h" -#include "base/command_line.h" #include "base/logging.h" #include "base/memory/singleton.h" #include "base/memory/weak_ptr.h" @@ -30,10 +31,10 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/views/select_file_dialog_extension.h" #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" -#include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/file_browser_handler.h" +#include "chrome/common/pref_names.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" @@ -430,7 +431,7 @@ void RequestLocalFileSystemFunction::RequestOnFileThread( const GURL& source_url, int child_id) { GURL origin_url = source_url.GetOrigin(); BrowserContext::GetFileSystemContext(profile())->OpenFileSystem( - origin_url, fileapi::kFileSystemTypeExternal, false, // create + origin_url, fileapi::kFileSystemTypeExternal, false, // create LocalFileSystemCallbackDispatcher::CreateCallback( this, profile(), @@ -1535,8 +1536,8 @@ bool FileDialogStringsFunction::RunImpl() { ChromeURLDataManager::DataSource::SetFontAndTextDirection(dict); - if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableGData)) - dict->SetString("ENABLE_GDATA", "1"); + if (!profile_->GetPrefs()->GetBoolean(prefs::kDisableGData)) + dict->SetString("ENABLE_GDATA", "1"); return true; } diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index 4641710..9b1663b 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc @@ -96,6 +96,15 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kUse24HourClock, base::GetHourClockType() == base::k24HourClock, PrefService::SYNCABLE_PREF); + prefs->RegisterBooleanPref(prefs::kDisableGData, + false, + PrefService::SYNCABLE_PREF); + prefs->RegisterBooleanPref(prefs::kDisableGDataOverCellular, + true, + PrefService::SYNCABLE_PREF); + prefs->RegisterBooleanPref(prefs::kDisableGDataHostedFiles, + false, + PrefService::SYNCABLE_PREF); // We don't sync prefs::kLanguageCurrentInputMethod and PreviousInputMethod // because they're just used to track the logout state of the device. prefs->RegisterStringPref(prefs::kLanguageCurrentInputMethod, @@ -240,6 +249,11 @@ void Preferences::Init(PrefService* prefs) { accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, prefs, this); sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, this); use_24hour_clock_.Init(prefs::kUse24HourClock, prefs, this); + disable_gdata_.Init(prefs::kDisableGData, prefs, this); + disable_gdata_over_cellular_.Init(prefs::kDisableGDataOverCellular, + prefs, this); + disable_gdata_hosted_files_.Init(prefs::kDisableGDataHostedFiles, + prefs, this); primary_mouse_button_right_.Init(prefs::kPrimaryMouseButtonRight, prefs, this); hotkey_next_engine_in_menu_.Init( diff --git a/chrome/browser/chromeos/preferences.h b/chrome/browser/chromeos/preferences.h index ee5aeb5..f7b8844 100644 --- a/chrome/browser/chromeos/preferences.h +++ b/chrome/browser/chromeos/preferences.h @@ -92,8 +92,11 @@ class Preferences : public content::NotificationObserver { BooleanPrefMember accessibility_enabled_; IntegerPrefMember speed_factor_; IntegerPrefMember sensitivity_; - BooleanPrefMember use_24hour_clock_; BooleanPrefMember primary_mouse_button_right_; + BooleanPrefMember use_24hour_clock_; + BooleanPrefMember disable_gdata_; + BooleanPrefMember disable_gdata_over_cellular_; + BooleanPrefMember disable_gdata_hosted_files_; // Input method preferences. StringPrefMember hotkey_next_engine_in_menu_; diff --git a/chrome/browser/policy/configuration_policy_handler_list.cc b/chrome/browser/policy/configuration_policy_handler_list.cc index 4b7a830..c5b33d7 100644 --- a/chrome/browser/policy/configuration_policy_handler_list.cc +++ b/chrome/browser/policy/configuration_policy_handler_list.cc @@ -296,6 +296,12 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = { { key::kChromeOsReleaseChannel, prefs::kChromeOsReleaseChannel, Value::TYPE_STRING }, + { key::kGDataDisabled, + prefs::kDisableGData, + Value::TYPE_BOOLEAN }, + { key::kGDataDisabledOverCellular, + prefs::kDisableGDataOverCellular, + Value::TYPE_BOOLEAN }, #endif // defined(OS_CHROMEOS) #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc index db8f45d..61526c2 100644 --- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc +++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc @@ -111,7 +111,8 @@ TEST_P(ConfigurationPolicyPrefStoreStringTest, GetDefault) { TEST_P(ConfigurationPolicyPrefStoreStringTest, SetValue) { provider_.AddMandatoryPolicy(GetParam().policy_name(), - base::Value::CreateStringValue("http://chromium.org")); + base::Value::CreateStringValue( + "http://chromium.org")); store_->OnUpdatePolicy(&provider_); const base::Value* value = NULL; EXPECT_EQ(PrefStore::READ_OK, @@ -274,7 +275,11 @@ INSTANTIATE_TEST_CASE_P( ConfigurationPolicyPrefStoreBooleanTest, testing::Values( PolicyAndPref(key::kChromeOsLockOnIdleSuspend, - prefs::kEnableScreenLock))); + prefs::kEnableScreenLock), + PolicyAndPref(key::kGDataDisabled, + prefs::kDisableGData), + PolicyAndPref(key::kGDataDisabledOverCellular, + prefs::kDisableGDataOverCellular))); #endif // defined(OS_CHROMEOS) // Test cases for integer-valued policy settings. diff --git a/chrome/browser/prefs/command_line_pref_store.cc b/chrome/browser/prefs/command_line_pref_store.cc index 6200b52..ba83704 100644 --- a/chrome/browser/prefs/command_line_pref_store.cc +++ b/chrome/browser/prefs/command_line_pref_store.cc @@ -59,6 +59,9 @@ const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry #else { switches::kEnablePrintPreview, prefs::kPrintPreviewDisabled, false }, #endif +#if defined(OS_CHROMEOS) + { switches::kDisableGData, prefs::kDisableGData, true }, +#endif }; const CommandLinePrefStore::IntegerSwitchToPreferenceMapEntry diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index c4de724..0ddfec2 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -469,6 +469,15 @@ const char kTouchpadSensitivity[] = "settings.touchpad.sensitivity2"; // A boolean pref set to true if time should be displayed in 24-hour clock. const char kUse24HourClock[] = "settings.clock.use_24hour_clock"; +// A boolean pref to disable gdata. +const char kDisableGData[] = "gdata.disabled"; + +// A boolean pref to disable gdata over cellular connections. +const char kDisableGDataOverCellular[] = "gdata.cellular.disabled"; + +// A boolean pref to disable gdata hosted files. +const char kDisableGDataHostedFiles[] = "gdata.hosted_files.disabled"; + // A string pref set to the current input method. const char kLanguageCurrentInputMethod[] = "settings.language.current_input_method"; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index dc9fca8..7d8178f 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -171,6 +171,9 @@ extern const char kTapToClickEnabled[]; extern const char kPrimaryMouseButtonRight[]; extern const char kTouchpadSensitivity[]; extern const char kUse24HourClock[]; +extern const char kDisableGData[]; +extern const char kDisableGDataOverCellular[]; +extern const char kDisableGDataHostedFiles[]; // TODO(yusukes): Change "kLanguageABC" to "kABC". The current form is too long // to remember and confusing. The prefs are actually for input methods and i18n // keyboards, not UI languages. diff --git a/chrome/test/functional/policy_test_cases.py b/chrome/test/functional/policy_test_cases.py index 173a033..57870f2 100755 --- a/chrome/test/functional/policy_test_cases.py +++ b/chrome/test/functional/policy_test_cases.py @@ -169,6 +169,8 @@ class PolicyPrefsTestCases(object): 'ChromeOsLockOnIdleSuspend': (True, [ BROWSER ], [ 'chromeos' ]), 'PolicyRefreshRate': (300000, [], [ 'chromeos' ]), 'OpenNetworkConfiguration': ('', [], [ 'chromeos' ]), + 'GDataDisabled': (True, [], [ 'chromeos' ]), + 'GDataDisabledOverCellular': (True, [], [ 'chromeos' ]), # ChromeOS Device policies: 'DevicePolicyRefreshRate': (300000, [], []), |