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_SESSIONS_SESSIONS_API_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSIONS_API_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSIONS_API_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSIONS_API_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 protected: | 31 protected: |
32 ~SessionsGetRecentlyClosedFunction() override {} | 32 ~SessionsGetRecentlyClosedFunction() override {} |
33 bool RunSync() override; | 33 bool RunSync() override; |
34 DECLARE_EXTENSION_FUNCTION("sessions.getRecentlyClosed", | 34 DECLARE_EXTENSION_FUNCTION("sessions.getRecentlyClosed", |
35 SESSIONS_GETRECENTLYCLOSED) | 35 SESSIONS_GETRECENTLYCLOSED) |
36 | 36 |
37 private: | 37 private: |
38 api::tabs::Tab CreateTabModel(const sessions::TabRestoreService::Tab& tab, | 38 api::tabs::Tab CreateTabModel(const sessions::TabRestoreService::Tab& tab, |
39 int session_id, | 39 int session_id, |
40 int selected_index); | 40 int selected_index); |
41 scoped_ptr<api::windows::Window> CreateWindowModel( | 41 std::unique_ptr<api::windows::Window> CreateWindowModel( |
42 const sessions::TabRestoreService::Window& window, | 42 const sessions::TabRestoreService::Window& window, |
43 int session_id); | 43 int session_id); |
44 scoped_ptr<api::sessions::Session> CreateSessionModel( | 44 std::unique_ptr<api::sessions::Session> CreateSessionModel( |
45 const sessions::TabRestoreService::Entry* entry); | 45 const sessions::TabRestoreService::Entry* entry); |
46 }; | 46 }; |
47 | 47 |
48 class SessionsGetDevicesFunction : public ChromeSyncExtensionFunction { | 48 class SessionsGetDevicesFunction : public ChromeSyncExtensionFunction { |
49 protected: | 49 protected: |
50 ~SessionsGetDevicesFunction() override {} | 50 ~SessionsGetDevicesFunction() override {} |
51 bool RunSync() override; | 51 bool RunSync() override; |
52 DECLARE_EXTENSION_FUNCTION("sessions.getDevices", SESSIONS_GETDEVICES) | 52 DECLARE_EXTENSION_FUNCTION("sessions.getDevices", SESSIONS_GETDEVICES) |
53 | 53 |
54 private: | 54 private: |
55 api::tabs::Tab CreateTabModel(const std::string& session_tag, | 55 api::tabs::Tab CreateTabModel(const std::string& session_tag, |
56 const sessions::SessionTab& tab, | 56 const sessions::SessionTab& tab, |
57 int tab_index, | 57 int tab_index, |
58 int selected_index); | 58 int selected_index); |
59 scoped_ptr<api::windows::Window> CreateWindowModel( | 59 std::unique_ptr<api::windows::Window> CreateWindowModel( |
60 const sessions::SessionWindow& window, | 60 const sessions::SessionWindow& window, |
61 const std::string& session_tag); | 61 const std::string& session_tag); |
62 scoped_ptr<api::sessions::Session> CreateSessionModel( | 62 std::unique_ptr<api::sessions::Session> CreateSessionModel( |
63 const sessions::SessionWindow& window, | 63 const sessions::SessionWindow& window, |
64 const std::string& session_tag); | 64 const std::string& session_tag); |
65 api::sessions::Device CreateDeviceModel( | 65 api::sessions::Device CreateDeviceModel( |
66 const sync_driver::SyncedSession* session); | 66 const sync_driver::SyncedSession* session); |
67 }; | 67 }; |
68 | 68 |
69 class SessionsRestoreFunction : public ChromeSyncExtensionFunction { | 69 class SessionsRestoreFunction : public ChromeSyncExtensionFunction { |
70 protected: | 70 protected: |
71 ~SessionsRestoreFunction() override {} | 71 ~SessionsRestoreFunction() override {} |
72 bool RunSync() override; | 72 bool RunSync() override; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 content::BrowserContext* browser_context_; | 127 content::BrowserContext* browser_context_; |
128 | 128 |
129 // BrowserContextKeyedAPI implementation. | 129 // BrowserContextKeyedAPI implementation. |
130 static const char* service_name() { | 130 static const char* service_name() { |
131 return "SessionsAPI"; | 131 return "SessionsAPI"; |
132 } | 132 } |
133 static const bool kServiceIsNULLWhileTesting = true; | 133 static const bool kServiceIsNULLWhileTesting = true; |
134 | 134 |
135 // Created lazily upon OnListenerAdded. | 135 // Created lazily upon OnListenerAdded. |
136 scoped_ptr<SessionsEventRouter> sessions_event_router_; | 136 std::unique_ptr<SessionsEventRouter> sessions_event_router_; |
137 | 137 |
138 DISALLOW_COPY_AND_ASSIGN(SessionsAPI); | 138 DISALLOW_COPY_AND_ASSIGN(SessionsAPI); |
139 }; | 139 }; |
140 | 140 |
141 } // namespace extensions | 141 } // namespace extensions |
142 | 142 |
143 #endif // CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSIONS_API_H__ | 143 #endif // CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSIONS_API_H__ |
OLD | NEW |