summaryrefslogtreecommitdiffstats
path: root/ios/public
diff options
context:
space:
mode:
authorblundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-01 14:58:10 +0000
committerblundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-01 14:58:10 +0000
commit22afac4f37b7ff1ad94224b0b26ddac89757916c (patch)
tree11e225e6b196070225d1bb0be9135983929b8595 /ios/public
parent29515f445f085ae33c6342853e02166d6255300b (diff)
downloadchromium_src-22afac4f37b7ff1ad94224b0b26ddac89757916c.zip
chromium_src-22afac4f37b7ff1ad94224b0b26ddac89757916c.tar.gz
chromium_src-22afac4f37b7ff1ad94224b0b26ddac89757916c.tar.bz2
Create top-level ios/public/ directory.
To better mirror the structure of other API layers (content/public and third_party/WebKit/public), there will be a single ios/public/ directory that contains all interfaces referenced by not-yet-upstreamed Chrome for iOS code, rather than these interfaces being scattered in subdirectories further underneath ios/. This CL also changes gyp structure to better match other modules: ios_consumer.gyp is moved to directly under ios/, and an ios.gyp is created with a single top-level "ios" target to be used in build/all.gyp. Review URL: https://chromiumcodereview.appspot.com/18272004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ios/public')
-rw-r--r--ios/public/DEPS11
-rw-r--r--ios/public/consumer/base/supports_user_data.h50
-rw-r--r--ios/public/consumer/base/util.h18
3 files changed, 79 insertions, 0 deletions
diff --git a/ios/public/DEPS b/ios/public/DEPS
new file mode 100644
index 0000000..b9ffa71
--- /dev/null
+++ b/ios/public/DEPS
@@ -0,0 +1,11 @@
+include_rules = [
+ # The public interfaces cannot reference Chromium code, so all allowances
+ # that the top-level DEPS file introduces are removed here. This list should
+ # be kept in sync with src/DEPS.
+ "-base",
+ "-build",
+ "-googleurl",
+ "-library_loaders",
+ "-testing",
+ "-third_party/icu/public",
+]
diff --git a/ios/public/consumer/base/supports_user_data.h b/ios/public/consumer/base/supports_user_data.h
new file mode 100644
index 0000000..5986c57
--- /dev/null
+++ b/ios/public/consumer/base/supports_user_data.h
@@ -0,0 +1,50 @@
+// 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 IOS_PUBLIC_CONSUMER_BASE_SUPPORTS_USER_DATA_H_
+#define IOS_PUBLIC_CONSUMER_BASE_SUPPORTS_USER_DATA_H_
+
+namespace ios {
+
+class SupportsUserDataInternal;
+
+// This is a helper for classes that want to allow users to stash random data by
+// key. At destruction all the objects will be destructed.
+class SupportsUserData {
+ public:
+ SupportsUserData();
+
+ // Derive from this class and add your own data members to associate extra
+ // information with this object. Alternatively, add this as a public base
+ // class to any class with a virtual destructor.
+ class Data {
+ public:
+ virtual ~Data() {}
+ };
+
+ // The user data allows the clients to associate data with this object.
+ // Multiple user data values can be stored under different keys.
+ // This object will TAKE OWNERSHIP of the given data pointer, and will
+ // delete the object if it is changed or the object is destroyed.
+ Data* GetUserData(const void* key) const;
+ void SetUserData(const void* key, Data* data);
+ void RemoveUserData(const void* key);
+
+ // SupportsUserData is not thread-safe, and on debug build will assert it is
+ // only used on one thread. Calling this method allows the caller to hand
+ // the SupportsUserData instance across threads. Use only if you are taking
+ // full control of the synchronization of that handover.
+ void DetachUserDataThread();
+
+ protected:
+ virtual ~SupportsUserData();
+
+ private:
+ // Owned by this object and scoped to its lifetime.
+ SupportsUserDataInternal* internal_helper_;
+};
+
+} // namespace ios
+
+#endif // IOS_PUBLIC_CONSUMER_BASE_SUPPORTS_USER_DATA_H_
diff --git a/ios/public/consumer/base/util.h b/ios/public/consumer/base/util.h
new file mode 100644
index 0000000..5977ea7
--- /dev/null
+++ b/ios/public/consumer/base/util.h
@@ -0,0 +1,18 @@
+// 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 IOS_PUBLIC_CONSUMER_BASE_UTIL_H_
+#define IOS_PUBLIC_CONSUMER_BASE_UTIL_H_
+
+namespace ios {
+
+// Returns whether the operating system is iOS 6 or later.
+bool IsRunningOnIOS6OrLater();
+
+// Returns whether the operating system is at the given version or later.
+bool IsRunningOnOrLater(int major, int minor, int bug_fix);
+
+} // namespace ios
+
+#endif // IOS_PUBLIC_CONSUMER_BASE_UTIL_H_