OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SESSION_RESTORE_SESSION_RESTORE_API_H__ | |
6 #define CHROME_BROWSER_EXTENSIONS_API_SESSION_RESTORE_SESSION_RESTORE_API_H__ | |
7 | |
8 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | |
9 #include "chrome/browser/extensions/extension_function.h" | |
10 #include "chrome/browser/sessions/tab_restore_service.h" | |
11 #include "chrome/common/extensions/api/session_restore.h" | |
12 #include "chrome/common/extensions/api/tabs.h" | |
13 #include "chrome/common/extensions/api/windows.h" | |
14 | |
15 class Profile; | |
16 | |
17 namespace extensions { | |
18 | |
19 class SessionRestoreGetRecentlyClosedFunction : public SyncExtensionFunction { | |
20 protected: | |
21 virtual ~SessionRestoreGetRecentlyClosedFunction() {} | |
22 virtual bool RunImpl() OVERRIDE; | |
23 DECLARE_EXTENSION_FUNCTION("sessionRestore.getRecentlyClosed", | |
24 SESSIONRESTORE_GETRECENTLYCLOSED) | |
25 | |
26 private: | |
27 scoped_ptr<api::tabs::Tab> CreateTabModel( | |
28 const TabRestoreService::Tab& tab, int selected_index); | |
29 scoped_ptr<api::windows::Window> CreateWindowModel( | |
30 const TabRestoreService::Window& window); | |
31 scoped_ptr<api::session_restore::ClosedEntry> CreateEntryModel( | |
32 const TabRestoreService::Entry* entry); | |
33 }; | |
34 | |
35 class SessionRestoreRestoreFunction : public SyncExtensionFunction { | |
36 protected: | |
37 virtual ~SessionRestoreRestoreFunction() {} | |
38 virtual bool RunImpl() OVERRIDE; | |
39 DECLARE_EXTENSION_FUNCTION("sessionRestore.restore", SESSIONRESTORE_RESTORE) | |
40 }; | |
41 | |
42 class SessionRestoreAPI : public ProfileKeyedAPI { | |
43 public: | |
44 explicit SessionRestoreAPI(Profile* profile); | |
45 virtual ~SessionRestoreAPI(); | |
46 | |
47 // ProfileKeyedAPI implementation. | |
48 static ProfileKeyedAPIFactory<SessionRestoreAPI>* GetFactoryInstance(); | |
49 private: | |
50 friend class ProfileKeyedAPIFactory<SessionRestoreAPI>; | |
51 | |
52 // ProfileKeyedAPI implementation. | |
53 static const char* service_name() { | |
54 return "SessionRestoreAPI"; | |
55 } | |
56 static const bool kServiceIsNULLWhileTesting = true; | |
57 }; | |
58 | |
59 } // namespace extensions | |
60 | |
61 #endif // CHROME_BROWSER_EXTENSIONS_API_SESSION_RESTORE_SESSION_RESTORE_API_H__ | |
OLD | NEW |