Chromium Code Reviews| 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_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "chrome/browser/sync/sessions/synced_window_delegates_getter.h" | |
| 11 #include "components/sessions/session_id.h" | 13 #include "components/sessions/session_id.h" |
| 12 | 14 |
| 13 class Profile; | 15 class Profile; |
| 14 | 16 |
| 15 namespace content { | 17 namespace content { |
| 16 class NavigationEntry; | 18 class NavigationEntry; |
| 17 class WebContents; | 19 class WebContents; |
| 18 } | 20 } |
| 19 | 21 |
| 20 namespace browser_sync { | 22 namespace browser_sync { |
| 21 class SyncedWindowDelegate; | 23 class SyncedWindowDelegate; |
| 22 | 24 |
| 23 // A SyncedTabDelegate is used to insulate the sync code from depending | 25 // A SyncedTabDelegate is used to insulate the sync code from depending |
| 24 // directly on WebContents, NavigationController, and the extensions TabHelper. | 26 // directly on WebContents, NavigationController, and the extensions TabHelper. |
| 25 class SyncedTabDelegate { | 27 class SyncedTabDelegate { |
| 26 public: | 28 public: |
| 27 virtual ~SyncedTabDelegate() {} | 29 SyncedTabDelegate(); |
|
Nicolas Zea
2015/08/31 22:12:47
nit: I think it would be better to make this const
maxbogue
2015/09/01 17:29:27
Done.
| |
| 30 virtual ~SyncedTabDelegate(); | |
| 28 | 31 |
| 29 // Methods from TabContents. | 32 // Methods from TabContents. |
| 30 | 33 |
| 31 virtual SessionID::id_type GetWindowId() const = 0; | 34 virtual SessionID::id_type GetWindowId() const = 0; |
| 32 virtual SessionID::id_type GetSessionId() const = 0; | 35 virtual SessionID::id_type GetSessionId() const = 0; |
| 33 virtual bool IsBeingDestroyed() const = 0; | 36 virtual bool IsBeingDestroyed() const = 0; |
| 34 virtual Profile* profile() const = 0; | 37 virtual Profile* profile() const = 0; |
| 35 | 38 |
| 36 // Method derived from extensions TabHelper. | 39 // Method derived from extensions TabHelper. |
| 37 | 40 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 62 virtual bool HasWebContents() const = 0; | 65 virtual bool HasWebContents() const = 0; |
| 63 virtual content::WebContents* GetWebContents() const = 0; | 66 virtual content::WebContents* GetWebContents() const = 0; |
| 64 | 67 |
| 65 // Session sync related methods. | 68 // Session sync related methods. |
| 66 virtual int GetSyncId() const = 0; | 69 virtual int GetSyncId() const = 0; |
| 67 virtual void SetSyncId(int sync_id) = 0; | 70 virtual void SetSyncId(int sync_id) = 0; |
| 68 | 71 |
| 69 // Returns true if this tab should be synchronized. | 72 // Returns true if this tab should be synchronized. |
| 70 bool ShouldSync() const; | 73 bool ShouldSync() const; |
| 71 | 74 |
| 75 void SetSyncedWindowGetter(scoped_ptr<SyncedWindowDelegatesGetter> getter); | |
|
Nicolas Zea
2015/08/31 22:12:47
Add comment? Would probably be good to also explai
maxbogue
2015/09/01 17:29:27
Done.
| |
| 76 | |
| 72 // Returns the SyncedTabDelegate associated with WebContents. | 77 // Returns the SyncedTabDelegate associated with WebContents. |
| 73 static SyncedTabDelegate* ImplFromWebContents( | 78 static SyncedTabDelegate* ImplFromWebContents( |
| 74 content::WebContents* web_contents); | 79 content::WebContents* web_contents); |
| 75 | 80 |
| 76 protected: | 81 protected: |
| 77 // Overridden by the tests to avoid interaction with static state. | 82 // Overridden by the tests to avoid interaction with static state. |
| 78 virtual const SyncedWindowDelegate* GetSyncedWindowDelegate() const; | 83 virtual const SyncedWindowDelegate* GetSyncedWindowDelegate() const; |
| 84 | |
| 85 scoped_ptr<SyncedWindowDelegatesGetter> synced_window_getter_; | |
|
Nicolas Zea
2015/08/31 22:12:47
make private?
maxbogue
2015/09/01 17:29:27
Done.
| |
| 79 }; | 86 }; |
| 80 | 87 |
| 81 } // namespace browser_sync | 88 } // namespace browser_sync |
| 82 | 89 |
| 83 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__ | 90 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__ |
| OLD | NEW |