Move functions for controlling Caps Lock to CapsLockDelegate from SystemTrayDelegate.
[chromium-blink-merge.git] / base / message_loop_proxy_impl.h
blob2bcd8fd54686bab121f59a5317fd962b61f799f8
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_MESSAGE_LOOP_PROXY_IMPL_H_
6 #define BASE_MESSAGE_LOOP_PROXY_IMPL_H_
8 #include "base/base_export.h"
9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h"
11 #include "base/synchronization/lock.h"
13 namespace base {
15 // A stock implementation of MessageLoopProxy that is created and managed by a
16 // MessageLoop. For now a MessageLoopProxyImpl can only be created as part of a
17 // MessageLoop.
18 class BASE_EXPORT MessageLoopProxyImpl : public MessageLoopProxy {
19 public:
20 // MessageLoopProxy implementation
21 virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
22 const base::Closure& task,
23 base::TimeDelta delay) OVERRIDE;
24 virtual bool PostNonNestableDelayedTask(
25 const tracked_objects::Location& from_here,
26 const base::Closure& task,
27 base::TimeDelta delay) OVERRIDE;
28 virtual bool RunsTasksOnCurrentThread() const OVERRIDE;
30 protected:
31 virtual ~MessageLoopProxyImpl();
33 // Override OnDestruct so that we can delete the object on the target message
34 // loop if it still exists.
35 virtual void OnDestruct() const OVERRIDE;
37 private:
38 // Allow the MessageLoop to create a MessageLoopProxyImpl.
39 friend class ::MessageLoop;
40 friend class DeleteHelper<MessageLoopProxyImpl>;
42 MessageLoopProxyImpl();
44 // Called directly by MessageLoop::~MessageLoop.
45 virtual void WillDestroyCurrentMessageLoop();
48 bool PostTaskHelper(const tracked_objects::Location& from_here,
49 const base::Closure& task,
50 base::TimeDelta delay,
51 bool nestable);
53 // The lock that protects access to target_message_loop_.
54 mutable base::Lock message_loop_lock_;
55 MessageLoop* target_message_loop_;
57 DISALLOW_COPY_AND_ASSIGN(MessageLoopProxyImpl);
60 } // namespace base
62 #endif // BASE_MESSAGE_LOOP_PROXY_IMPL_H_