diff options
author | dconnelly@chromium.org <dconnelly@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-05 13:13:46 +0000 |
---|---|---|
committer | dconnelly@chromium.org <dconnelly@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-05 13:13:46 +0000 |
commit | 4a9ab5173f4c1ea61f695ddcf59f05b9e4ab6c20 (patch) | |
tree | 7d182b01248dee53bb8b4104dfe37c1b0933c583 /chrome/browser | |
parent | dde3e9cb5128757e35ba5b9fa71cdf2abe01041d (diff) | |
download | chromium_src-4a9ab5173f4c1ea61f695ddcf59f05b9e4ab6c20.zip chromium_src-4a9ab5173f4c1ea61f695ddcf59f05b9e4ab6c20.tar.gz chromium_src-4a9ab5173f4c1ea61f695ddcf59f05b9e4ab6c20.tar.bz2 |
Move PreferencesMac to components/policy/.
This is a re-land of https://codereview.chromium.org/78603003/
BUG=271392
R=joaodasilva,jochen
Review URL: https://codereview.chromium.org/104373002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238960 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/media_galleries/fileapi/iapps_finder_impl_mac.mm | 2 | ||||
-rw-r--r-- | chrome/browser/media_galleries/fileapi/picasa_finder_mac.mm | 2 | ||||
-rw-r--r-- | chrome/browser/media_galleries/media_galleries_test_util.cc | 2 | ||||
-rw-r--r-- | chrome/browser/policy/browser_policy_connector.cc | 2 | ||||
-rw-r--r-- | chrome/browser/policy/policy_loader_mac.cc | 2 | ||||
-rw-r--r-- | chrome/browser/policy/policy_loader_mac_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/policy/preferences_mac.cc | 19 | ||||
-rw-r--r-- | chrome/browser/policy/preferences_mac.h | 34 | ||||
-rw-r--r-- | chrome/browser/policy/preferences_mock_mac.cc | 47 | ||||
-rw-r--r-- | chrome/browser/policy/preferences_mock_mac.h | 33 |
10 files changed, 6 insertions, 139 deletions
diff --git a/chrome/browser/media_galleries/fileapi/iapps_finder_impl_mac.mm b/chrome/browser/media_galleries/fileapi/iapps_finder_impl_mac.mm index 04abf15..d1d7572 100644 --- a/chrome/browser/media_galleries/fileapi/iapps_finder_impl_mac.mm +++ b/chrome/browser/media_galleries/fileapi/iapps_finder_impl_mac.mm @@ -10,8 +10,8 @@ #import "base/mac/foundation_util.h" #import "base/mac/scoped_nsobject.h" #include "base/time/time.h" -#include "chrome/browser/policy/preferences_mac.h" #include "chrome/browser/storage_monitor/storage_info.h" +#include "components/policy/core/common/preferences_mac.h" #include "content/public/browser/browser_thread.h" using base::mac::CFCast; diff --git a/chrome/browser/media_galleries/fileapi/picasa_finder_mac.mm b/chrome/browser/media_galleries/fileapi/picasa_finder_mac.mm index 1a3dead..a01c350 100644 --- a/chrome/browser/media_galleries/fileapi/picasa_finder_mac.mm +++ b/chrome/browser/media_galleries/fileapi/picasa_finder_mac.mm @@ -7,7 +7,7 @@ #include "base/files/file_path.h" #import "base/mac/foundation_util.h" #import "base/mac/scoped_nsobject.h" -#include "chrome/browser/policy/preferences_mac.h" +#include "components/policy/core/common/preferences_mac.h" #include "content/public/browser/browser_thread.h" using base::mac::CFCast; diff --git a/chrome/browser/media_galleries/media_galleries_test_util.cc b/chrome/browser/media_galleries/media_galleries_test_util.cc index 4696003..79ebcc6 100644 --- a/chrome/browser/media_galleries/media_galleries_test_util.cc +++ b/chrome/browser/media_galleries/media_galleries_test_util.cc @@ -27,7 +27,7 @@ #include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" #include "chrome/browser/media_galleries/fileapi/iapps_finder_impl.h" -#include "chrome/browser/policy/preferences_mock_mac.h" +#include "components/policy/core/common/preferences_mock_mac.h" #endif // OS_MACOSX #if defined(OS_WIN) diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc index 5c452ac..bccc637 100644 --- a/chrome/browser/policy/browser_policy_connector.cc +++ b/chrome/browser/policy/browser_policy_connector.cc @@ -56,7 +56,7 @@ #elif defined(OS_MACOSX) && !defined(OS_IOS) #include <CoreFoundation/CoreFoundation.h> #include "chrome/browser/policy/policy_loader_mac.h" -#include "chrome/browser/policy/preferences_mac.h" +#include "components/policy/core/common/preferences_mac.h" #elif defined(OS_POSIX) && !defined(OS_ANDROID) #include "chrome/browser/policy/config_dir_policy_loader.h" #endif diff --git a/chrome/browser/policy/policy_loader_mac.cc b/chrome/browser/policy/policy_loader_mac.cc index 04a5e6f..1ee42ee 100644 --- a/chrome/browser/policy/policy_loader_mac.cc +++ b/chrome/browser/policy/policy_loader_mac.cc @@ -16,10 +16,10 @@ #include "base/strings/sys_string_conversions.h" #include "base/values.h" #include "chrome/browser/policy/policy_load_status.h" -#include "chrome/browser/policy/preferences_mac.h" #include "components/policy/core/common/external_data_fetcher.h" #include "components/policy/core/common/policy_bundle.h" #include "components/policy/core/common/policy_map.h" +#include "components/policy/core/common/preferences_mac.h" #include "components/policy/core/common/schema.h" #include "components/policy/core/common/schema_map.h" diff --git a/chrome/browser/policy/policy_loader_mac_unittest.cc b/chrome/browser/policy/policy_loader_mac_unittest.cc index 00a8cd5..5445447 100644 --- a/chrome/browser/policy/policy_loader_mac_unittest.cc +++ b/chrome/browser/policy/policy_loader_mac_unittest.cc @@ -11,12 +11,12 @@ #include "base/strings/sys_string_conversions.h" #include "base/values.h" #include "chrome/browser/policy/policy_loader_mac.h" -#include "chrome/browser/policy/preferences_mock_mac.h" #include "components/policy/core/common/async_policy_provider.h" #include "components/policy/core/common/configuration_policy_provider_test.h" #include "components/policy/core/common/external_data_fetcher.h" #include "components/policy/core/common/policy_bundle.h" #include "components/policy/core/common/policy_map.h" +#include "components/policy/core/common/preferences_mock_mac.h" #include "testing/gtest/include/gtest/gtest.h" using base::ScopedCFTypeRef; diff --git a/chrome/browser/policy/preferences_mac.cc b/chrome/browser/policy/preferences_mac.cc deleted file mode 100644 index cfc041f..0000000 --- a/chrome/browser/policy/preferences_mac.cc +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/policy/preferences_mac.h" - -Boolean MacPreferences::AppSynchronize(CFStringRef applicationID) { - return CFPreferencesAppSynchronize(applicationID); -} - -CFPropertyListRef MacPreferences::CopyAppValue(CFStringRef key, - CFStringRef applicationID) { - return CFPreferencesCopyAppValue(key, applicationID); -} - -Boolean MacPreferences::AppValueIsForced(CFStringRef key, - CFStringRef applicationID) { - return CFPreferencesAppValueIsForced(key, applicationID); -} diff --git a/chrome/browser/policy/preferences_mac.h b/chrome/browser/policy/preferences_mac.h deleted file mode 100644 index 31a46d8..0000000 --- a/chrome/browser/policy/preferences_mac.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_POLICY_PREFERENCES_MAC_H_ -#define CHROME_BROWSER_POLICY_PREFERENCES_MAC_H_ - -#include <CoreFoundation/CoreFoundation.h> - -#include "base/basictypes.h" - -// Wraps a small part of the CFPreferences API surface in a very thin layer, to -// allow it to be mocked out for testing. - -// See CFPreferences documentation for function documentation, as these call -// through directly to their CFPreferences equivalents (Foo -> -// CFPreferencesFoo). -class MacPreferences { - public: - MacPreferences() {} - virtual ~MacPreferences() {} - - virtual Boolean AppSynchronize(CFStringRef applicationID); - - virtual CFPropertyListRef CopyAppValue(CFStringRef key, - CFStringRef applicationID); - - virtual Boolean AppValueIsForced(CFStringRef key, CFStringRef applicationID); - - private: - DISALLOW_COPY_AND_ASSIGN(MacPreferences); -}; - -#endif // CHROME_BROWSER_POLICY_PREFERENCES_MAC_H_ diff --git a/chrome/browser/policy/preferences_mock_mac.cc b/chrome/browser/policy/preferences_mock_mac.cc deleted file mode 100644 index 9d11df6..0000000 --- a/chrome/browser/policy/preferences_mock_mac.cc +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/policy/preferences_mock_mac.h" - -MockPreferences::MockPreferences() { - values_.reset(CFDictionaryCreateMutable(kCFAllocatorDefault, - 0, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks)); - forced_.reset(CFSetCreateMutable(kCFAllocatorDefault, - 0, - &kCFTypeSetCallBacks)); -} - -MockPreferences::~MockPreferences() { -} - -Boolean MockPreferences::AppSynchronize(CFStringRef applicationID) { - return true; -} - -CFPropertyListRef MockPreferences::CopyAppValue(CFStringRef key, - CFStringRef applicationID) { - CFPropertyListRef value; - Boolean found = CFDictionaryGetValueIfPresent(values_, - key, - &value); - if (!found || !value) - return NULL; - CFRetain(value); - return value; -} - -Boolean MockPreferences::AppValueIsForced(CFStringRef key, - CFStringRef applicationID) { - return CFSetContainsValue(forced_, key); -} - -void MockPreferences::AddTestItem(CFStringRef key, - CFPropertyListRef value, - bool is_forced) { - CFDictionarySetValue(values_, key, value); - if (is_forced) - CFSetAddValue(forced_, key); -} diff --git a/chrome/browser/policy/preferences_mock_mac.h b/chrome/browser/policy/preferences_mock_mac.h deleted file mode 100644 index 3a28816..0000000 --- a/chrome/browser/policy/preferences_mock_mac.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_POLICY_PREFERENCES_MOCK_MAC_H_ -#define CHROME_BROWSER_POLICY_PREFERENCES_MOCK_MAC_H_ - -#include "base/mac/scoped_cftyperef.h" -#include "chrome/browser/policy/preferences_mac.h" - -// Mock preferences wrapper for testing code that interacts with CFPreferences. -class MockPreferences : public MacPreferences { - public: - MockPreferences(); - virtual ~MockPreferences(); - - virtual Boolean AppSynchronize(CFStringRef applicationID) OVERRIDE; - - virtual CFPropertyListRef CopyAppValue(CFStringRef key, - CFStringRef applicationID) OVERRIDE; - - virtual Boolean AppValueIsForced(CFStringRef key, - CFStringRef applicationID) OVERRIDE; - - // Adds a preference item with the given info to the test set. - void AddTestItem(CFStringRef key, CFPropertyListRef value, bool is_forced); - - private: - base::ScopedCFTypeRef<CFMutableDictionaryRef> values_; - base::ScopedCFTypeRef<CFMutableSetRef> forced_; -}; - -#endif // CHROME_BROWSER_POLICY_PREFERENCES_MOCK_MAC_H_ |