Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: chrome/browser/ui/webui/ntp/foreign_session_handler.h

Issue 9959030: Allow hiding of sessions from Other Devices via context menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/time.h"
11 #include "chrome/browser/sessions/session_service.h" 12 #include "chrome/browser/sessions/session_service.h"
12 #include "chrome/browser/sync/glue/session_model_associator.h" 13 #include "chrome/browser/sync/glue/session_model_associator.h"
13 #include "content/public/browser/notification_observer.h" 14 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h" 15 #include "content/public/browser/notification_registrar.h"
15 #include "content/public/browser/web_ui_message_handler.h" 16 #include "content/public/browser/web_ui_message_handler.h"
16 17
17 namespace browser_sync { 18 namespace browser_sync {
18 19
19 class ForeignSessionHandler : public content::WebUIMessageHandler, 20 class ForeignSessionHandler : public content::WebUIMessageHandler,
20 public content::NotificationObserver { 21 public content::NotificationObserver {
(...skipping 12 matching lines...) Expand all
33 virtual void Observe(int type, 34 virtual void Observe(int type,
34 const content::NotificationSource& source, 35 const content::NotificationSource& source,
35 const content::NotificationDetails& details) OVERRIDE; 36 const content::NotificationDetails& details) OVERRIDE;
36 37
37 // Returns a pointer to the current session model associator or NULL. 38 // Returns a pointer to the current session model associator or NULL.
38 SessionModelAssociator* GetModelAssociator(); 39 SessionModelAssociator* GetModelAssociator();
39 40
40 // Returns true if tab sync is enabled for this profile, otherwise false. 41 // Returns true if tab sync is enabled for this profile, otherwise false.
41 bool IsTabSyncEnabled(); 42 bool IsTabSyncEnabled();
42 43
44 // Returns a string used to show the user when a session was last modified.
45 string16 FormatSessionTime(const base::Time& time);
46
43 // Determines which session is to be opened, and then calls 47 // Determines which session is to be opened, and then calls
44 // OpenForeignSession, to begin the process of opening a new browser window. 48 // OpenForeignSession, to begin the process of opening a new browser window.
45 // This is a javascript callback handler. 49 // This is a javascript callback handler.
46 void HandleOpenForeignSession(const ListValue* args); 50 void HandleOpenForeignSession(const ListValue* args);
47 51
48 // Determines whether foreign sessions should be obtained from the sync model. 52 // Determines whether foreign sessions should be obtained from the sync model.
49 // This is a javascript callback handler, and it is also called when the sync 53 // This is a javascript callback handler, and it is also called when the sync
50 // model has changed and the new tab page needs to reflect the changes. 54 // model has changed and the new tab page needs to reflect the changes.
51 void HandleGetForeignSessions(const ListValue* args); 55 void HandleGetForeignSessions(const ListValue* args);
52 56
57 // Delete a foreign session. This will remove it from the list of foreign
58 // sessions on all devices. It will reappear if the session is re-activated
59 // on the original device.
60 // This is a javascript callback handler.
61 void HandleDeleteForeignSession(const ListValue* args);
62
53 // Helper methods to create JSON compatible objects from Session objects. 63 // Helper methods to create JSON compatible objects from Session objects.
54 bool SessionTabToValue(const SessionTab& tab, DictionaryValue* dictionary); 64 bool SessionTabToValue(const SessionTab& tab, DictionaryValue* dictionary);
55 bool SessionWindowToValue(const SessionWindow& window, 65 bool SessionWindowToValue(const SessionWindow& window,
56 DictionaryValue* dictionary); 66 DictionaryValue* dictionary);
57 67
58 // The Registrar used to register ForeignSessionHandler for notifications. 68 // The Registrar used to register ForeignSessionHandler for notifications.
59 content::NotificationRegistrar registrar_; 69 content::NotificationRegistrar registrar_;
60 70
61 DISALLOW_COPY_AND_ASSIGN(ForeignSessionHandler); 71 DISALLOW_COPY_AND_ASSIGN(ForeignSessionHandler);
62 }; 72 };
63 73
64 } // namespace browser_sync 74 } // namespace browser_sync
65 75
66 #endif // CHROME_BROWSER_UI_WEBUI_NTP_FOREIGN_SESSION_HANDLER_H_ 76 #endif // CHROME_BROWSER_UI_WEBUI_NTP_FOREIGN_SESSION_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/other_sessions.js ('k') | chrome/browser/ui/webui/ntp/foreign_session_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698