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 #include "chrome/browser/sync/test/integration/sessions_helper.h" | 5 #include "chrome/browser/sync/test/integration/sessions_helper.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 class TabEventHandler : public browser_sync::LocalSessionEventHandler { | 133 class TabEventHandler : public browser_sync::LocalSessionEventHandler { |
134 public: | 134 public: |
135 TabEventHandler() : weak_factory_(this) { | 135 TabEventHandler() : weak_factory_(this) { |
136 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 136 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
137 FROM_HERE, | 137 FROM_HERE, |
138 base::Bind(&TabEventHandler::QuitLoop, weak_factory_.GetWeakPtr()), | 138 base::Bind(&TabEventHandler::QuitLoop, weak_factory_.GetWeakPtr()), |
139 TestTimeouts::action_max_timeout()); | 139 TestTimeouts::action_max_timeout()); |
140 } | 140 } |
141 | 141 |
142 void OnLocalTabModified( | 142 bool OnLocalTabModified( |
143 browser_sync::SyncedTabDelegate* modified_tab) override { | 143 browser_sync::SyncedTabDelegate* modified_tab) override { |
144 // Unwind to ensure SessionsSyncManager has processed the event. | 144 // Unwind to ensure SessionsSyncManager has processed the event. |
145 base::ThreadTaskRunnerHandle::Get()->PostTask( | 145 base::ThreadTaskRunnerHandle::Get()->PostTask( |
146 FROM_HERE, | 146 FROM_HERE, |
147 base::Bind(&TabEventHandler::QuitLoop, weak_factory_.GetWeakPtr())); | 147 base::Bind(&TabEventHandler::QuitLoop, weak_factory_.GetWeakPtr())); |
| 148 return true; |
148 } | 149 } |
149 | 150 |
150 void OnFaviconsChanged(const std::set<GURL>& /* page_urls */, | 151 void OnFaviconsChanged(const std::set<GURL>& /* page_urls */, |
151 const GURL& /* icon_url */) override { | 152 const GURL& /* icon_url */) override { |
152 // Unwind to ensure SessionsSyncManager has processed the event. | 153 // Unwind to ensure SessionsSyncManager has processed the event. |
153 base::ThreadTaskRunnerHandle::Get()->PostTask( | 154 base::ThreadTaskRunnerHandle::Get()->PostTask( |
154 FROM_HERE, | 155 FROM_HERE, |
155 base::Bind(&TabEventHandler::QuitLoop, weak_factory_.GetWeakPtr())); | 156 base::Bind(&TabEventHandler::QuitLoop, weak_factory_.GetWeakPtr())); |
156 } | 157 } |
157 | 158 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 return !checker.TimedOut(); | 427 return !checker.TimedOut(); |
427 } | 428 } |
428 | 429 |
429 void DeleteForeignSession(int index, std::string session_tag) { | 430 void DeleteForeignSession(int index, std::string session_tag) { |
430 ProfileSyncServiceFactory::GetInstance()->GetForProfile( | 431 ProfileSyncServiceFactory::GetInstance()->GetForProfile( |
431 test()->GetProfile(index))-> | 432 test()->GetProfile(index))-> |
432 GetOpenTabsUIDelegate()->DeleteForeignSession(session_tag); | 433 GetOpenTabsUIDelegate()->DeleteForeignSession(session_tag); |
433 } | 434 } |
434 | 435 |
435 } // namespace sessions_helper | 436 } // namespace sessions_helper |
OLD | NEW |