OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_DISPLAY_PR
IVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_DISPLAY_PR
IVATE_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_DISPLAY_PR
IVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_DISPLAY_PR
IVATE_API_H_ |
7 | 7 |
8 #include "base/scoped_observer.h" | 8 #include "base/scoped_observer.h" |
9 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er.h" | 9 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er.h" |
10 #include "chrome/common/extensions/api/braille_display_private.h" | 10 #include "chrome/common/extensions/api/braille_display_private.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 void OnListenerAdded(const EventListenerInfo& details) override; | 46 void OnListenerAdded(const EventListenerInfo& details) override; |
47 void OnListenerRemoved(const EventListenerInfo& details) override; | 47 void OnListenerRemoved(const EventListenerInfo& details) override; |
48 | 48 |
49 private: | 49 private: |
50 friend class BrowserContextKeyedAPIFactory<BrailleDisplayPrivateAPI>; | 50 friend class BrowserContextKeyedAPIFactory<BrailleDisplayPrivateAPI>; |
51 friend class api::braille_display_private::BrailleDisplayPrivateAPIUserTest; | 51 friend class api::braille_display_private::BrailleDisplayPrivateAPIUserTest; |
52 | 52 |
53 class EventDelegate { | 53 class EventDelegate { |
54 public: | 54 public: |
55 virtual ~EventDelegate() {} | 55 virtual ~EventDelegate() {} |
56 virtual void BroadcastEvent(scoped_ptr<Event> event) = 0; | 56 virtual void BroadcastEvent(std::unique_ptr<Event> event) = 0; |
57 virtual bool HasListener() = 0; | 57 virtual bool HasListener() = 0; |
58 }; | 58 }; |
59 | 59 |
60 class DefaultEventDelegate; | 60 class DefaultEventDelegate; |
61 | 61 |
62 // Returns whether the profile that this API was created for is currently | 62 // Returns whether the profile that this API was created for is currently |
63 // the active profile. | 63 // the active profile. |
64 bool IsProfileActive(); | 64 bool IsProfileActive(); |
65 | 65 |
66 void SetEventDelegateForTest(scoped_ptr<EventDelegate> delegate); | 66 void SetEventDelegateForTest(std::unique_ptr<EventDelegate> delegate); |
67 | 67 |
68 Profile* profile_; | 68 Profile* profile_; |
69 ScopedObserver<api::braille_display_private::BrailleController, | 69 ScopedObserver<api::braille_display_private::BrailleController, |
70 BrailleObserver> scoped_observer_; | 70 BrailleObserver> scoped_observer_; |
71 scoped_ptr<EventDelegate> event_delegate_; | 71 std::unique_ptr<EventDelegate> event_delegate_; |
72 | 72 |
73 // BrowserContextKeyedAPI implementation. | 73 // BrowserContextKeyedAPI implementation. |
74 static const char* service_name() { | 74 static const char* service_name() { |
75 return "BrailleDisplayPrivateAPI"; | 75 return "BrailleDisplayPrivateAPI"; |
76 } | 76 } |
77 // Override the default so the service is not created in tests. | 77 // Override the default so the service is not created in tests. |
78 static const bool kServiceIsNULLWhileTesting = true; | 78 static const bool kServiceIsNULLWhileTesting = true; |
79 }; | 79 }; |
80 | 80 |
81 namespace api { | 81 namespace api { |
(...skipping 14 matching lines...) Expand all Loading... |
96 public: | 96 public: |
97 BrailleDisplayPrivateWriteDotsFunction(); | 97 BrailleDisplayPrivateWriteDotsFunction(); |
98 | 98 |
99 protected: | 99 protected: |
100 ~BrailleDisplayPrivateWriteDotsFunction() override; | 100 ~BrailleDisplayPrivateWriteDotsFunction() override; |
101 bool Prepare() override; | 101 bool Prepare() override; |
102 void Work() override; | 102 void Work() override; |
103 bool Respond() override; | 103 bool Respond() override; |
104 | 104 |
105 private: | 105 private: |
106 scoped_ptr<braille_display_private::WriteDots::Params> params_; | 106 std::unique_ptr<braille_display_private::WriteDots::Params> params_; |
107 }; | 107 }; |
108 | 108 |
109 } // namespace api | 109 } // namespace api |
110 } // namespace extensions | 110 } // namespace extensions |
111 | 111 |
112 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_DISPLAY
_PRIVATE_API_H_ | 112 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_DISPLAY
_PRIVATE_API_H_ |
OLD | NEW |