| 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 "chrome/browser/ui/webui/foreign_session_handler.h" | 5 #include "chrome/browser/ui/webui/foreign_session_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 LOG(ERROR) << "ForeignSessionHandler failed to get session data from" | 175 LOG(ERROR) << "ForeignSessionHandler failed to get session data from" |
| 176 "OpenTabsUIDelegate."; | 176 "OpenTabsUIDelegate."; |
| 177 return; | 177 return; |
| 178 } | 178 } |
| 179 std::vector<const ::sessions::SessionWindow*>::const_iterator iter_begin = | 179 std::vector<const ::sessions::SessionWindow*>::const_iterator iter_begin = |
| 180 windows.begin() + (window_num == kInvalidId ? 0 : window_num); | 180 windows.begin() + (window_num == kInvalidId ? 0 : window_num); |
| 181 std::vector<const ::sessions::SessionWindow*>::const_iterator iter_end = | 181 std::vector<const ::sessions::SessionWindow*>::const_iterator iter_end = |
| 182 window_num == kInvalidId ? | 182 window_num == kInvalidId ? |
| 183 std::vector<const ::sessions::SessionWindow*>::const_iterator( | 183 std::vector<const ::sessions::SessionWindow*>::const_iterator( |
| 184 windows.end()) : iter_begin + 1; | 184 windows.end()) : iter_begin + 1; |
| 185 chrome::HostDesktopType host_desktop_type = | 185 ui::HostDesktopType host_desktop_type = |
| 186 chrome::GetHostDesktopTypeForNativeView( | 186 chrome::GetHostDesktopTypeForNativeView( |
| 187 web_ui->GetWebContents()->GetNativeView()); | 187 web_ui->GetWebContents()->GetNativeView()); |
| 188 SessionRestore::RestoreForeignSessionWindows( | 188 SessionRestore::RestoreForeignSessionWindows( |
| 189 Profile::FromWebUI(web_ui), host_desktop_type, iter_begin, iter_end); | 189 Profile::FromWebUI(web_ui), host_desktop_type, iter_begin, iter_end); |
| 190 } | 190 } |
| 191 | 191 |
| 192 // static | 192 // static |
| 193 sync_driver::OpenTabsUIDelegate* ForeignSessionHandler::GetOpenTabsUIDelegate( | 193 sync_driver::OpenTabsUIDelegate* ForeignSessionHandler::GetOpenTabsUIDelegate( |
| 194 content::WebUI* web_ui) { | 194 content::WebUI* web_ui) { |
| 195 Profile* profile = Profile::FromWebUI(web_ui); | 195 Profile* profile = Profile::FromWebUI(web_ui); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 // collapsed state persists. | 441 // collapsed state persists. |
| 442 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 442 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
| 443 DictionaryPrefUpdate update(prefs, prefs::kNtpCollapsedForeignSessions); | 443 DictionaryPrefUpdate update(prefs, prefs::kNtpCollapsedForeignSessions); |
| 444 if (is_collapsed) | 444 if (is_collapsed) |
| 445 update.Get()->SetBoolean(session_tag, true); | 445 update.Get()->SetBoolean(session_tag, true); |
| 446 else | 446 else |
| 447 update.Get()->Remove(session_tag, NULL); | 447 update.Get()->Remove(session_tag, NULL); |
| 448 } | 448 } |
| 449 | 449 |
| 450 } // namespace browser_sync | 450 } // namespace browser_sync |
| OLD | NEW |