| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DOM_UI_FOREIGN_SESSION_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_FOREIGN_SESSION_HANDLER_H_ |
| 6 #define CHROME_BROWSER_DOM_UI_FOREIGN_SESSION_HANDLER_H_ | 6 #define CHROME_BROWSER_DOM_UI_FOREIGN_SESSION_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 virtual void RegisterMessages(); | 23 virtual void RegisterMessages(); |
| 24 | 24 |
| 25 ForeignSessionHandler(); | 25 ForeignSessionHandler(); |
| 26 virtual ~ForeignSessionHandler() {} | 26 virtual ~ForeignSessionHandler() {} |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 // Used to register ForeignSessionHandler for notifications. | 29 // Used to register ForeignSessionHandler for notifications. |
| 30 void Init(); | 30 void Init(); |
| 31 | 31 |
| 32 // Determines how ForeignSessionHandler will interact with the new tab page. | 32 // Determines how ForeignSessionHandler will interact with the new tab page. |
| 33 void Observe(NotificationType type, const NotificationSource& source, | 33 virtual void Observe(NotificationType type, |
| 34 const NotificationDetails& details); | 34 const NotificationSource& source, |
| 35 const NotificationDetails& details); |
| 35 | 36 |
| 36 // Returns a pointer to the current session model associator or NULL. | 37 // Returns a pointer to the current session model associator or NULL. |
| 37 SessionModelAssociator* GetModelAssociator(); | 38 SessionModelAssociator* GetModelAssociator(); |
| 38 | 39 |
| 39 // Determines whether foreign sessions should be obtained from the sync model. | 40 // Determines whether foreign sessions should be obtained from the sync model. |
| 40 // This is a javascript callback handler, and it is also called when the sync | 41 // This is a javascript callback handler, and it is also called when the sync |
| 41 // model has changed and the new tab page needs to reflect the changes. | 42 // model has changed and the new tab page needs to reflect the changes. |
| 42 void HandleGetForeignSessions(const ListValue* args); | 43 void HandleGetForeignSessions(const ListValue* args); |
| 43 | 44 |
| 44 // Helper for reopening a foreign session in a new browser window. | 45 // Helper for reopening a foreign session in a new browser window. |
| 45 void OpenForeignSession(SessionModelAssociator* associator, int64 id); | 46 void OpenForeignSession(SessionModelAssociator* associator, int64 id); |
| 46 | 47 |
| 47 // Helper for listing the foreign sessions on the new tab page. | 48 // Helper for listing the foreign sessions on the new tab page. |
| 48 void GetForeignSessions(SessionModelAssociator* associator); | 49 void GetForeignSessions(SessionModelAssociator* associator); |
| 49 | 50 |
| 50 // Determines which session is to be opened, and then calls | 51 // Determines which session is to be opened, and then calls |
| 51 // OpenForeignSession, to begin the process of opening a new browser window. | 52 // OpenForeignSession, to begin the process of opening a new browser window. |
| 52 // This is a javascript callback handler. | 53 // This is a javascript callback handler. |
| 53 void HandleReopenForeignSession(const ListValue* args); | 54 void HandleReopenForeignSession(const ListValue* args); |
| 54 | 55 |
| 55 // The Registrar used to register ForeignSessionHandler for notifications. | 56 // The Registrar used to register ForeignSessionHandler for notifications. |
| 56 NotificationRegistrar registrar_; | 57 NotificationRegistrar registrar_; |
| 57 | 58 |
| 58 DISALLOW_COPY_AND_ASSIGN(ForeignSessionHandler); | 59 DISALLOW_COPY_AND_ASSIGN(ForeignSessionHandler); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 } // namespace browser_sync | 62 } // namespace browser_sync |
| 62 | 63 |
| 63 #endif // CHROME_BROWSER_DOM_UI_FOREIGN_SESSION_HANDLER_H_ | 64 #endif // CHROME_BROWSER_DOM_UI_FOREIGN_SESSION_HANDLER_H_ |
| OLD | NEW |