| 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" |
| 11 #include "chrome/browser/extensions/chrome_extension_function.h" | 11 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 12 #include "chrome/common/extensions/api/sessions.h" | 12 #include "chrome/common/extensions/api/sessions.h" |
| 13 #include "chrome/common/extensions/api/tabs.h" | 13 #include "chrome/common/extensions/api/tabs.h" |
| 14 #include "chrome/common/extensions/api/windows.h" | 14 #include "chrome/common/extensions/api/windows.h" |
| 15 #include "components/sessions/core/tab_restore_service.h" | 15 #include "components/sessions/core/tab_restore_service.h" |
| 16 #include "components/sessions/core/tab_restore_service_observer.h" | 16 #include "components/sessions/core/tab_restore_service_observer.h" |
| 17 #include "extensions/browser/browser_context_keyed_api_factory.h" | 17 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 18 #include "extensions/browser/event_router.h" | 18 #include "extensions/browser/event_router.h" |
| 19 | 19 |
| 20 class Profile; | 20 class Profile; |
| 21 | 21 |
| 22 namespace sync_driver { | 22 namespace sync_sessions { |
| 23 struct SyncedSession; | 23 struct SyncedSession; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace extensions { | 26 namespace extensions { |
| 27 | 27 |
| 28 class SessionId; | 28 class SessionId; |
| 29 | 29 |
| 30 class SessionsGetRecentlyClosedFunction : public ChromeSyncExtensionFunction { | 30 class SessionsGetRecentlyClosedFunction : public ChromeSyncExtensionFunction { |
| 31 protected: | 31 protected: |
| 32 ~SessionsGetRecentlyClosedFunction() override {} | 32 ~SessionsGetRecentlyClosedFunction() override {} |
| (...skipping 21 matching lines...) Expand all Loading... |
| 54 const sessions::SessionTab& tab, | 54 const sessions::SessionTab& tab, |
| 55 int tab_index, | 55 int tab_index, |
| 56 bool active); | 56 bool active); |
| 57 std::unique_ptr<api::windows::Window> CreateWindowModel( | 57 std::unique_ptr<api::windows::Window> CreateWindowModel( |
| 58 const sessions::SessionWindow& window, | 58 const sessions::SessionWindow& window, |
| 59 const std::string& session_tag); | 59 const std::string& session_tag); |
| 60 std::unique_ptr<api::sessions::Session> CreateSessionModel( | 60 std::unique_ptr<api::sessions::Session> CreateSessionModel( |
| 61 const sessions::SessionWindow& window, | 61 const sessions::SessionWindow& window, |
| 62 const std::string& session_tag); | 62 const std::string& session_tag); |
| 63 api::sessions::Device CreateDeviceModel( | 63 api::sessions::Device CreateDeviceModel( |
| 64 const sync_driver::SyncedSession* session); | 64 const sync_sessions::SyncedSession* session); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 class SessionsRestoreFunction : public ChromeSyncExtensionFunction { | 67 class SessionsRestoreFunction : public ChromeSyncExtensionFunction { |
| 68 protected: | 68 protected: |
| 69 ~SessionsRestoreFunction() override {} | 69 ~SessionsRestoreFunction() override {} |
| 70 bool RunSync() override; | 70 bool RunSync() override; |
| 71 DECLARE_EXTENSION_FUNCTION("sessions.restore", SESSIONS_RESTORE) | 71 DECLARE_EXTENSION_FUNCTION("sessions.restore", SESSIONS_RESTORE) |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 void SetInvalidIdError(const std::string& invalid_id); | 74 void SetInvalidIdError(const std::string& invalid_id); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 // Created lazily upon OnListenerAdded. | 133 // Created lazily upon OnListenerAdded. |
| 134 std::unique_ptr<SessionsEventRouter> sessions_event_router_; | 134 std::unique_ptr<SessionsEventRouter> sessions_event_router_; |
| 135 | 135 |
| 136 DISALLOW_COPY_AND_ASSIGN(SessionsAPI); | 136 DISALLOW_COPY_AND_ASSIGN(SessionsAPI); |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 } // namespace extensions | 139 } // namespace extensions |
| 140 | 140 |
| 141 #endif // CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSIONS_API_H__ | 141 #endif // CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSIONS_API_H__ |
| OLD | NEW |