| 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/stl_util.h" | 6 #include "base/stl_util.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/sync/glue/synced_session_tracker.h" | 8 #include "chrome/browser/sync/glue/synced_session_tracker.h" |
| 9 | 9 |
| 10 namespace browser_sync { | 10 namespace browser_sync { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 return false; | 190 return false; |
| 191 } | 191 } |
| 192 | 192 |
| 193 bool SyncedSessionTracker::DeleteOldSessionTabIfNecessary( | 193 bool SyncedSessionTracker::DeleteOldSessionTabIfNecessary( |
| 194 SessionTabWrapper tab_wrapper) { | 194 SessionTabWrapper tab_wrapper) { |
| 195 if (!tab_wrapper.owned) { | 195 if (!tab_wrapper.owned) { |
| 196 if (VLOG_IS_ON(1)) { | 196 if (VLOG_IS_ON(1)) { |
| 197 SessionTab* tab_ptr = tab_wrapper.tab_ptr; | 197 SessionTab* tab_ptr = tab_wrapper.tab_ptr; |
| 198 std::string title; | 198 std::string title; |
| 199 if (tab_ptr->navigations.size() > 0) { | 199 if (tab_ptr->navigations.size() > 0) { |
| 200 title = " (" + UTF16ToUTF8( | 200 title = " (" + base::UTF16ToUTF8( |
| 201 tab_ptr->navigations[tab_ptr->navigations.size()-1].title()) + ")"; | 201 tab_ptr->navigations[tab_ptr->navigations.size()-1].title()) + ")"; |
| 202 } | 202 } |
| 203 DVLOG(1) << "Deleting closed tab " << tab_ptr->tab_id.id() << title | 203 DVLOG(1) << "Deleting closed tab " << tab_ptr->tab_id.id() << title |
| 204 << " from window " << tab_ptr->window_id.id(); | 204 << " from window " << tab_ptr->window_id.id(); |
| 205 } | 205 } |
| 206 unmapped_tabs_.erase(tab_wrapper.tab_ptr); | 206 unmapped_tabs_.erase(tab_wrapper.tab_ptr); |
| 207 delete tab_wrapper.tab_ptr; | 207 delete tab_wrapper.tab_ptr; |
| 208 return true; | 208 return true; |
| 209 } | 209 } |
| 210 return false; | 210 return false; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 DLOG(ERROR) | 334 DLOG(ERROR) |
| 335 << "Updating tab_node_id for " << session_tag << " tab: " << tab_id | 335 << "Updating tab_node_id for " << session_tag << " tab: " << tab_id |
| 336 << " from: " << iter->second.tab_node_id << " to: " << tab_node_id; | 336 << " from: " << iter->second.tab_node_id << " to: " << tab_node_id; |
| 337 } | 337 } |
| 338 iter->second.tab_node_id = tab_node_id; | 338 iter->second.tab_node_id = tab_node_id; |
| 339 } | 339 } |
| 340 | 340 |
| 341 if (VLOG_IS_ON(1)) { | 341 if (VLOG_IS_ON(1)) { |
| 342 std::string title; | 342 std::string title; |
| 343 if (tab_ptr->navigations.size() > 0) { | 343 if (tab_ptr->navigations.size() > 0) { |
| 344 title = " (" + UTF16ToUTF8( | 344 title = " (" + base::UTF16ToUTF8( |
| 345 tab_ptr->navigations[tab_ptr->navigations.size()-1].title()) + ")"; | 345 tab_ptr->navigations[tab_ptr->navigations.size()-1].title()) + ")"; |
| 346 } | 346 } |
| 347 DVLOG(1) << "Getting " | 347 DVLOG(1) << "Getting " |
| 348 << (session_tag == local_session_tag_ ? | 348 << (session_tag == local_session_tag_ ? |
| 349 "local session" : session_tag) | 349 "local session" : session_tag) |
| 350 << "'s seen tab " << tab_id << " at " << tab_ptr << title; | 350 << "'s seen tab " << tab_id << " at " << tab_ptr << title; |
| 351 } | 351 } |
| 352 } else { | 352 } else { |
| 353 tab_ptr = new SessionTab(); | 353 tab_ptr = new SessionTab(); |
| 354 tab_ptr->tab_id.set_id(tab_id); | 354 tab_ptr->tab_id.set_id(tab_id); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 376 | 376 |
| 377 // Get rid of our Window/Tab maps (does not delete the actual Window/Tabs | 377 // Get rid of our Window/Tab maps (does not delete the actual Window/Tabs |
| 378 // themselves; they should have all been deleted above). | 378 // themselves; they should have all been deleted above). |
| 379 synced_window_map_.clear(); | 379 synced_window_map_.clear(); |
| 380 synced_tab_map_.clear(); | 380 synced_tab_map_.clear(); |
| 381 | 381 |
| 382 local_session_tag_.clear(); | 382 local_session_tag_.clear(); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace browser_sync | 385 } // namespace browser_sync |
| OLD | NEW |