| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "sync/test/fake_server/sessions_hierarchy.h" | |
| 6 | |
| 7 #include <sstream> | |
| 8 #include <string> | |
| 9 | |
| 10 namespace fake_server { | |
| 11 | |
| 12 SessionsHierarchy::SessionsHierarchy() {} | |
| 13 | |
| 14 SessionsHierarchy::~SessionsHierarchy() {} | |
| 15 | |
| 16 void SessionsHierarchy::AddWindow( | |
| 17 const std::string& tab) { | |
| 18 SessionsHierarchy::Window window; | |
| 19 window.insert(tab); | |
| 20 windows_.insert(window); | |
| 21 } | |
| 22 | |
| 23 void SessionsHierarchy::AddWindow( | |
| 24 const std::multiset<std::string>& tabs) { | |
| 25 windows_.insert(tabs); | |
| 26 } | |
| 27 | |
| 28 std::string SessionsHierarchy::ToString() const { | |
| 29 std::stringstream output; | |
| 30 output << "{"; | |
| 31 for (WindowContainer::const_iterator window_it = windows_.begin(); | |
| 32 window_it != windows_.end(); ++window_it) { | |
| 33 if (window_it != windows_.begin()) | |
| 34 output << ","; | |
| 35 output << "{"; | |
| 36 | |
| 37 Window window = *window_it; | |
| 38 for (Window::const_iterator tab_it = window.begin(); tab_it != window.end(); | |
| 39 ++tab_it) { | |
| 40 if (tab_it != window.begin()) | |
| 41 output << ","; | |
| 42 output << *tab_it; | |
| 43 } | |
| 44 output << "}"; | |
| 45 } | |
| 46 output << "}"; | |
| 47 return output.str(); | |
| 48 } | |
| 49 | |
| 50 bool SessionsHierarchy::Equals(const SessionsHierarchy& other) const { | |
| 51 return windows_ == other.windows_; | |
| 52 } | |
| 53 | |
| 54 } // namespace fake_server | |
| OLD | NEW |