Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "components/sync/test/fake_server/sessions_hierarchy.h" | 5 #include "components/sync/test/fake_server/sessions_hierarchy.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 namespace fake_server { | 9 namespace fake_server { |
| 10 | 10 |
| 11 SessionsHierarchy::SessionsHierarchy() {} | 11 SessionsHierarchy::SessionsHierarchy() {} |
| 12 | 12 |
| 13 SessionsHierarchy::SessionsHierarchy(const SessionsHierarchy& other) = default; | |
| 14 | |
| 15 SessionsHierarchy::SessionsHierarchy( | |
| 16 std::initializer_list<std::multiset<std::string>> windows) | |
| 17 : windows_(windows) {} | |
| 18 | |
| 13 SessionsHierarchy::~SessionsHierarchy() {} | 19 SessionsHierarchy::~SessionsHierarchy() {} |
| 14 | 20 |
| 15 void SessionsHierarchy::AddWindow(const std::string& tab) { | 21 void SessionsHierarchy::AddWindow(const std::string& tab) { |
| 16 SessionsHierarchy::Window window; | 22 SessionsHierarchy::Window window; |
|
skym
2017/02/27 19:42:50
This could be re-written with initializer lists, r
Patrick Noland
2017/02/27 23:37:08
Done.
| |
| 17 window.insert(tab); | 23 window.insert(tab); |
| 18 windows_.insert(window); | 24 windows_.insert(window); |
| 19 } | 25 } |
| 20 | 26 |
| 21 void SessionsHierarchy::AddWindow(const std::multiset<std::string>& tabs) { | 27 void SessionsHierarchy::AddWindow(const std::multiset<std::string>& tabs) { |
| 22 windows_.insert(tabs); | 28 windows_.insert(tabs); |
| 23 } | 29 } |
| 24 | 30 |
| 25 std::string SessionsHierarchy::ToString() const { | 31 std::string SessionsHierarchy::ToString() const { |
| 26 std::stringstream output; | 32 std::stringstream output; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 42 } | 48 } |
| 43 output << "}"; | 49 output << "}"; |
| 44 return output.str(); | 50 return output.str(); |
| 45 } | 51 } |
| 46 | 52 |
| 47 bool SessionsHierarchy::Equals(const SessionsHierarchy& other) const { | 53 bool SessionsHierarchy::Equals(const SessionsHierarchy& other) const { |
| 48 return windows_ == other.windows_; | 54 return windows_ == other.windows_; |
| 49 } | 55 } |
| 50 | 56 |
| 51 } // namespace fake_server | 57 } // namespace fake_server |
| OLD | NEW |