OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/system_monitor.h" | 5 #include "app/system_monitor.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // Returns the state of the given tab strip as a string. The state consists | 141 // Returns the state of the given tab strip as a string. The state consists |
142 // of the ID of each tab contents followed by a 'p' if pinned. For example, | 142 // of the ID of each tab contents followed by a 'p' if pinned. For example, |
143 // if the model consists of two tabs with ids 2 and 1, with the first | 143 // if the model consists of two tabs with ids 2 and 1, with the first |
144 // tab pinned, this returns "2p 1". | 144 // tab pinned, this returns "2p 1". |
145 std::string GetPinnedState(const TabStripModel& model) { | 145 std::string GetPinnedState(const TabStripModel& model) { |
146 std::string actual; | 146 std::string actual; |
147 for (int i = 0; i < model.count(); ++i) { | 147 for (int i = 0; i < model.count(); ++i) { |
148 if (i > 0) | 148 if (i > 0) |
149 actual += " "; | 149 actual += " "; |
150 | 150 |
151 actual += IntToString(GetID(model.GetTabContentsAt(i))); | 151 actual += base::IntToString(GetID(model.GetTabContentsAt(i))); |
152 | 152 |
153 if (model.IsAppTab(i)) | 153 if (model.IsAppTab(i)) |
154 actual += "a"; | 154 actual += "a"; |
155 | 155 |
156 if (model.IsTabPinned(i)) | 156 if (model.IsTabPinned(i)) |
157 actual += "p"; | 157 actual += "p"; |
158 | 158 |
159 if (model.IsPhantomTab(i)) | 159 if (model.IsPhantomTab(i)) |
160 actual += "h"; | 160 actual += "h"; |
161 } | 161 } |
162 return actual; | 162 return actual; |
163 } | 163 } |
164 | 164 |
165 std::string GetIndicesClosedByCommandAsString( | 165 std::string GetIndicesClosedByCommandAsString( |
166 const TabStripModel& model, | 166 const TabStripModel& model, |
167 int index, | 167 int index, |
168 TabStripModel::ContextMenuCommand id) const { | 168 TabStripModel::ContextMenuCommand id) const { |
169 std::vector<int> indices = model.GetIndicesClosedByCommand(index, id); | 169 std::vector<int> indices = model.GetIndicesClosedByCommand(index, id); |
170 std::string result; | 170 std::string result; |
171 for (size_t i = 0; i < indices.size(); ++i) { | 171 for (size_t i = 0; i < indices.size(); ++i) { |
172 if (i != 0) | 172 if (i != 0) |
173 result += " "; | 173 result += " "; |
174 result += IntToString(indices[i]); | 174 result += base::IntToString(indices[i]); |
175 } | 175 } |
176 return result; | 176 return result; |
177 } | 177 } |
178 | 178 |
179 private: | 179 private: |
180 PropertyAccessor<int>* GetIDAccessor() { | 180 PropertyAccessor<int>* GetIDAccessor() { |
181 static PropertyAccessor<int> accessor; | 181 static PropertyAccessor<int> accessor; |
182 return &accessor; | 182 return &accessor; |
183 } | 183 } |
184 | 184 |
(...skipping 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 // Deleting the strip should delete the phanton tabcontents and result in one | 1925 // Deleting the strip should delete the phanton tabcontents and result in one |
1926 // TAB_CONTENTS_DESTROYED. | 1926 // TAB_CONTENTS_DESTROYED. |
1927 EXPECT_CALL(notification_observer, Observe(_, _, _)).Times(1); | 1927 EXPECT_CALL(notification_observer, Observe(_, _, _)).Times(1); |
1928 | 1928 |
1929 // Delete the tabstrip. | 1929 // Delete the tabstrip. |
1930 strip.reset(); | 1930 strip.reset(); |
1931 | 1931 |
1932 // And there should have been no methods sent to the TabStripModelObserver. | 1932 // And there should have been no methods sent to the TabStripModelObserver. |
1933 EXPECT_EQ(0, tabstrip_observer.GetStateCount()); | 1933 EXPECT_EQ(0, tabstrip_observer.GetStateCount()); |
1934 } | 1934 } |
OLD | NEW |