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

Side by Side Diff: chrome/browser/sync/glue/synced_tab_delegate.h

Issue 1310373009: [Sync] Remove static methods on SyncedWindowDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/sync/glue/synced_tab_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 virtual ~SyncedTabDelegate();
28 30
29 // Methods from TabContents. 31 // Methods from TabContents.
30 32
31 virtual SessionID::id_type GetWindowId() const = 0; 33 virtual SessionID::id_type GetWindowId() const = 0;
32 virtual SessionID::id_type GetSessionId() const = 0; 34 virtual SessionID::id_type GetSessionId() const = 0;
33 virtual bool IsBeingDestroyed() const = 0; 35 virtual bool IsBeingDestroyed() const = 0;
34 virtual Profile* profile() const = 0; 36 virtual Profile* profile() const = 0;
35 37
36 // Method derived from extensions TabHelper. 38 // Method derived from extensions TabHelper.
37 39
(...skipping 24 matching lines...) Expand all
62 virtual bool HasWebContents() const = 0; 64 virtual bool HasWebContents() const = 0;
63 virtual content::WebContents* GetWebContents() const = 0; 65 virtual content::WebContents* GetWebContents() const = 0;
64 66
65 // Session sync related methods. 67 // Session sync related methods.
66 virtual int GetSyncId() const = 0; 68 virtual int GetSyncId() const = 0;
67 virtual void SetSyncId(int sync_id) = 0; 69 virtual void SetSyncId(int sync_id) = 0;
68 70
69 // Returns true if this tab should be synchronized. 71 // Returns true if this tab should be synchronized.
70 bool ShouldSync() const; 72 bool ShouldSync() const;
71 73
74 // Sets the window getter. This must be called before any of the sync or
75 // supervised user methods on this class are called. It is currently set when
76 // the SyncTabDelegate is retrieved from WebContents via ImplFromWebContents.
77 void SetSyncedWindowGetter(scoped_ptr<SyncedWindowDelegatesGetter> getter);
78
72 // Returns the SyncedTabDelegate associated with WebContents. 79 // Returns the SyncedTabDelegate associated with WebContents.
73 static SyncedTabDelegate* ImplFromWebContents( 80 static SyncedTabDelegate* ImplFromWebContents(
74 content::WebContents* web_contents); 81 content::WebContents* web_contents);
75 82
76 protected: 83 protected:
84 SyncedTabDelegate();
85
77 // Overridden by the tests to avoid interaction with static state. 86 // Overridden by the tests to avoid interaction with static state.
78 virtual const SyncedWindowDelegate* GetSyncedWindowDelegate() const; 87 virtual const SyncedWindowDelegate* GetSyncedWindowDelegate() const;
88
89 private:
90 // A getter for accessing the associated SyncedWindowDelegate.
91 scoped_ptr<SyncedWindowDelegatesGetter> synced_window_getter_;
79 }; 92 };
80 93
81 } // namespace browser_sync 94 } // namespace browser_sync
82 95
83 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__ 96 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/glue/synced_tab_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698