| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_UI_WEBUI_NTP_FOREIGN_SESSION_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_FOREIGN_SESSION_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_NTP_FOREIGN_SESSION_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_FOREIGN_SESSION_HANDLER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace browser_sync { | 22 namespace browser_sync { |
| 23 | 23 |
| 24 class ForeignSessionHandler : public content::WebUIMessageHandler, | 24 class ForeignSessionHandler : public content::WebUIMessageHandler, |
| 25 public content::NotificationObserver { | 25 public content::NotificationObserver { |
| 26 public: | 26 public: |
| 27 // Invalid value, used to note that we don't have a tab or window number. | 27 // Invalid value, used to note that we don't have a tab or window number. |
| 28 static const int kInvalidId = -1; | 28 static const int kInvalidId = -1; |
| 29 | 29 |
| 30 // WebUIMessageHandler implementation. | 30 // WebUIMessageHandler implementation. |
| 31 virtual void RegisterMessages() OVERRIDE; | 31 virtual void RegisterMessages() override; |
| 32 | 32 |
| 33 ForeignSessionHandler(); | 33 ForeignSessionHandler(); |
| 34 virtual ~ForeignSessionHandler() {} | 34 virtual ~ForeignSessionHandler() {} |
| 35 | 35 |
| 36 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 36 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 37 | 37 |
| 38 static void OpenForeignSessionTab(content::WebUI* web_ui, | 38 static void OpenForeignSessionTab(content::WebUI* web_ui, |
| 39 const std::string& session_string_value, | 39 const std::string& session_string_value, |
| 40 SessionID::id_type window_num, | 40 SessionID::id_type window_num, |
| 41 SessionID::id_type tab_id, | 41 SessionID::id_type tab_id, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 52 // Returns a pointer to the current session model associator or NULL. | 52 // Returns a pointer to the current session model associator or NULL. |
| 53 static OpenTabsUIDelegate* GetOpenTabsUIDelegate(content::WebUI* web_ui); | 53 static OpenTabsUIDelegate* GetOpenTabsUIDelegate(content::WebUI* web_ui); |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 // Used to register ForeignSessionHandler for notifications. | 56 // Used to register ForeignSessionHandler for notifications. |
| 57 void Init(); | 57 void Init(); |
| 58 | 58 |
| 59 // Determines how ForeignSessionHandler will interact with the new tab page. | 59 // Determines how ForeignSessionHandler will interact with the new tab page. |
| 60 virtual void Observe(int type, | 60 virtual void Observe(int type, |
| 61 const content::NotificationSource& source, | 61 const content::NotificationSource& source, |
| 62 const content::NotificationDetails& details) OVERRIDE; | 62 const content::NotificationDetails& details) override; |
| 63 | 63 |
| 64 // Returns true if tab sync is enabled for this profile, otherwise false. | 64 // Returns true if tab sync is enabled for this profile, otherwise false. |
| 65 bool IsTabSyncEnabled(); | 65 bool IsTabSyncEnabled(); |
| 66 | 66 |
| 67 // Returns a string used to show the user when a session was last modified. | 67 // Returns a string used to show the user when a session was last modified. |
| 68 base::string16 FormatSessionTime(const base::Time& time); | 68 base::string16 FormatSessionTime(const base::Time& time); |
| 69 | 69 |
| 70 // Determines which session is to be opened, and then calls | 70 // Determines which session is to be opened, and then calls |
| 71 // OpenForeignSession, to begin the process of opening a new browser window. | 71 // OpenForeignSession, to begin the process of opening a new browser window. |
| 72 // This is a javascript callback handler. | 72 // This is a javascript callback handler. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 91 | 91 |
| 92 // The Registrar used to register ForeignSessionHandler for notifications. | 92 // The Registrar used to register ForeignSessionHandler for notifications. |
| 93 content::NotificationRegistrar registrar_; | 93 content::NotificationRegistrar registrar_; |
| 94 | 94 |
| 95 DISALLOW_COPY_AND_ASSIGN(ForeignSessionHandler); | 95 DISALLOW_COPY_AND_ASSIGN(ForeignSessionHandler); |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 } // namespace browser_sync | 98 } // namespace browser_sync |
| 99 | 99 |
| 100 #endif // CHROME_BROWSER_UI_WEBUI_NTP_FOREIGN_SESSION_HANDLER_H_ | 100 #endif // CHROME_BROWSER_UI_WEBUI_NTP_FOREIGN_SESSION_HANDLER_H_ |
| OLD | NEW |