| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/sessions_ui.h" | 5 #include "chrome/browser/ui/webui/sessions_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } | 177 } |
| 178 | 178 |
| 179 void SessionsDOMHandler::GetSessionList( | 179 void SessionsDOMHandler::GetSessionList( |
| 180 const std::vector<const browser_sync::SyncedSession*>& sessions, | 180 const std::vector<const browser_sync::SyncedSession*>& sessions, |
| 181 ListValue* session_list) { | 181 ListValue* session_list) { |
| 182 for (std::vector<const browser_sync::SyncedSession*>::const_iterator it = | 182 for (std::vector<const browser_sync::SyncedSession*>::const_iterator it = |
| 183 sessions.begin(); it != sessions.end(); ++it) { | 183 sessions.begin(); it != sessions.end(); ++it) { |
| 184 const browser_sync::SyncedSession* session = *it; | 184 const browser_sync::SyncedSession* session = *it; |
| 185 scoped_ptr<DictionaryValue> session_data(new DictionaryValue()); | 185 scoped_ptr<DictionaryValue> session_data(new DictionaryValue()); |
| 186 session_data->SetString("tag", session->session_tag); | 186 session_data->SetString("tag", session->session_tag); |
| 187 session_data->SetString("name", session->session_name); |
| 187 scoped_ptr<ListValue> window_list(new ListValue()); | 188 scoped_ptr<ListValue> window_list(new ListValue()); |
| 188 GetWindowList(session->windows, window_list.get()); | 189 GetWindowList(session->windows, window_list.get()); |
| 189 session_data->Set("windows", window_list.release()); | 190 session_data->Set("windows", window_list.release()); |
| 190 session_list->Append(session_data.release()); | 191 session_list->Append(session_data.release()); |
| 191 } | 192 } |
| 192 } | 193 } |
| 193 | 194 |
| 194 void SessionsDOMHandler::GetAllTabs( | 195 void SessionsDOMHandler::GetAllTabs( |
| 195 const std::vector<const browser_sync::SyncedSession*>& sessions, | 196 const std::vector<const browser_sync::SyncedSession*>& sessions, |
| 196 std::vector<SessionTab*>* all_tabs) { | 197 std::vector<SessionTab*>* all_tabs) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 265 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
| 265 profile->GetChromeURLDataManager()->AddDataSource( | 266 profile->GetChromeURLDataManager()->AddDataSource( |
| 266 CreateSessionsUIHTMLSource()); | 267 CreateSessionsUIHTMLSource()); |
| 267 } | 268 } |
| 268 | 269 |
| 269 // static | 270 // static |
| 270 RefCountedMemory* SessionsUI::GetFaviconResourceBytes() { | 271 RefCountedMemory* SessionsUI::GetFaviconResourceBytes() { |
| 271 return ResourceBundle::GetSharedInstance(). | 272 return ResourceBundle::GetSharedInstance(). |
| 272 LoadDataResourceBytes(IDR_HISTORY_FAVICON); | 273 LoadDataResourceBytes(IDR_HISTORY_FAVICON); |
| 273 } | 274 } |
| OLD | NEW |