summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-12 22:10:20 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-12 22:10:20 +0000
commit39a248b002d0f41ad816754bb2833eea0aff9c61 (patch)
tree2b3c12b82e8ba1779f3b5cf0b6e1783bb357c8bb /base
parentfe60fbbb329988a1b4eab5fcc78faaad719cda1b (diff)
downloadchromium_src-39a248b002d0f41ad816754bb2833eea0aff9c61.zip
chromium_src-39a248b002d0f41ad816754bb2833eea0aff9c61.tar.gz
chromium_src-39a248b002d0f41ad816754bb2833eea0aff9c61.tar.bz2
Adds the ability for save dialogs to take a default extension.
BUG=4287 TEST=see bug Review URL: http://codereview.chromium.org/10621 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5304 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/task.h14
-rw-r--r--base/tuple.h65
2 files changed, 79 insertions, 0 deletions
diff --git a/base/task.h b/base/task.h
index c1b25cf..a00555a 100644
--- a/base/task.h
+++ b/base/task.h
@@ -387,6 +387,20 @@ inline CancelableTask* NewRunnableMethod(T* object, Method method,
f));
}
+template <class T, class Method, class A, class B, class C, class D, class E,
+ class F, class G>
+inline CancelableTask* NewRunnableMethod(T* object, Method method,
+ const A& a, const B& b,
+ const C& c, const D& d, const E& e,
+ const F& f, const G& g) {
+ return new RunnableMethod<T,
+ Method,
+ Tuple7<A, B, C, D, E, F, G> >(object,
+ method,
+ MakeTuple(a, b, c, d,
+ e, f, g));
+}
+
// RunnableFunction and NewRunnableFunction implementation ---------------------
template <class Function, class Params>
diff --git a/base/tuple.h b/base/tuple.h
index a515830..8fd965f 100644
--- a/base/tuple.h
+++ b/base/tuple.h
@@ -233,6 +233,51 @@ public:
F f;
};
+template <class A, class B, class C, class D, class E, class F, class G>
+struct Tuple7 {
+public:
+ typedef A TypeA;
+ typedef B TypeB;
+ typedef C TypeC;
+ typedef D TypeD;
+ typedef E TypeE;
+ typedef F TypeF;
+ typedef G TypeG;
+ typedef Tuple7<typename TupleTraits<A>::ValueType,
+ typename TupleTraits<B>::ValueType,
+ typename TupleTraits<C>::ValueType,
+ typename TupleTraits<D>::ValueType,
+ typename TupleTraits<E>::ValueType,
+ typename TupleTraits<F>::ValueType,
+ typename TupleTraits<G>::ValueType> ValueTuple;
+ typedef Tuple7<typename TupleTraits<A>::RefType,
+ typename TupleTraits<B>::RefType,
+ typename TupleTraits<C>::RefType,
+ typename TupleTraits<D>::RefType,
+ typename TupleTraits<E>::RefType,
+ typename TupleTraits<F>::RefType,
+ typename TupleTraits<G>::RefType> RefTuple;
+
+ Tuple7() {}
+ Tuple7(typename TupleTraits<A>::ParamType a,
+ typename TupleTraits<B>::ParamType b,
+ typename TupleTraits<C>::ParamType c,
+ typename TupleTraits<D>::ParamType d,
+ typename TupleTraits<E>::ParamType e,
+ typename TupleTraits<F>::ParamType f,
+ typename TupleTraits<G>::ParamType g)
+ : a(a), b(b), c(c), d(d), e(e), f(f), g(g) {
+ }
+
+ A a;
+ B b;
+ C c;
+ D d;
+ E e;
+ F f;
+ G g;
+};
+
// Tuple creators -------------------------------------------------------------
//
// Helper functions for constructing tuples while inferring the template
@@ -275,6 +320,13 @@ inline Tuple6<A, B, C, D, E, F> MakeTuple(const A& a, const B& b, const C& c,
return Tuple6<A, B, C, D, E, F>(a, b, c, d, e, f);
}
+template <class A, class B, class C, class D, class E, class F, class G>
+inline Tuple7<A, B, C, D, E, F, G> MakeTuple(const A& a, const B& b, const C& c,
+ const D& d, const E& e, const F& f,
+ const G& g) {
+ return Tuple7<A, B, C, D, E, F, G>(a, b, c, d, e, f, g);
+}
+
// The following set of helpers make what Boost refers to as "Tiers" - a tuple
// of references.
@@ -309,6 +361,12 @@ inline Tuple6<A&, B&, C&, D&, E&, F&> MakeRefTuple(A& a, B& b, C& c, D& d, E& e,
return Tuple6<A&, B&, C&, D&, E&, F&>(a, b, c, d, e, f);
}
+template <class A, class B, class C, class D, class E, class F, class G>
+inline Tuple7<A&, B&, C&, D&, E&, F&, G&> MakeRefTuple(A& a, B& b, C& c, D& d,
+ E& e, F& f, G& g) {
+ return Tuple7<A&, B&, C&, D&, E&, F&, G&>(a, b, c, d, e, f, g);
+}
+
// Dispatchers ----------------------------------------------------------------
//
// Helper functions that call the given method on an object, with the unpacked
@@ -365,6 +423,13 @@ inline void DispatchToMethod(ObjT* obj, Method method,
(obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f);
}
+template<class ObjT, class Method, class A, class B, class C, class D, class E,
+ class F, class G>
+inline void DispatchToMethod(ObjT* obj, Method method,
+ const Tuple7<A, B, C, D, E, F, G>& arg) {
+ (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f, arg.g);
+}
+
// Static Dispatchers with no out params.
template <class Function>