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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 BuildWindowData(modification_time, 1)); | 331 BuildWindowData(modification_time, 1)); |
332 window_data->Set("tabs", tab_values.release()); | 332 window_data->Set("tabs", tab_values.release()); |
333 window_list->Append(std::move(window_data)); | 333 window_list->Append(std::move(window_data)); |
334 } | 334 } |
335 } | 335 } |
336 | 336 |
337 session_data->Set("windows", window_list.release()); | 337 session_data->Set("windows", window_list.release()); |
338 session_list.Append(std::move(session_data)); | 338 session_list.Append(std::move(session_data)); |
339 } | 339 } |
340 } | 340 } |
341 base::FundamentalValue tab_sync_enabled(IsTabSyncEnabled()); | 341 base::Value tab_sync_enabled(IsTabSyncEnabled()); |
342 web_ui()->CallJavascriptFunctionUnsafe("setForeignSessions", session_list, | 342 web_ui()->CallJavascriptFunctionUnsafe("setForeignSessions", session_list, |
343 tab_sync_enabled); | 343 tab_sync_enabled); |
344 } | 344 } |
345 | 345 |
346 void ForeignSessionHandler::HandleOpenForeignSession( | 346 void ForeignSessionHandler::HandleOpenForeignSession( |
347 const base::ListValue* args) { | 347 const base::ListValue* args) { |
348 size_t num_args = args->GetSize(); | 348 size_t num_args = args->GetSize(); |
349 // Expect either 1 or 8 args. For restoring an entire session, only | 349 // Expect either 1 or 8 args. For restoring an entire session, only |
350 // one argument is required -- the session tag. To restore a tab, | 350 // one argument is required -- the session tag. To restore a tab, |
351 // the additional args required are the window id, the tab id, | 351 // the additional args required are the window id, the tab id, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 // collapsed state persists. | 435 // collapsed state persists. |
436 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 436 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
437 DictionaryPrefUpdate update(prefs, prefs::kNtpCollapsedForeignSessions); | 437 DictionaryPrefUpdate update(prefs, prefs::kNtpCollapsedForeignSessions); |
438 if (is_collapsed) | 438 if (is_collapsed) |
439 update.Get()->SetBoolean(session_tag, true); | 439 update.Get()->SetBoolean(session_tag, true); |
440 else | 440 else |
441 update.Get()->Remove(session_tag, NULL); | 441 update.Get()->Remove(session_tag, NULL); |
442 } | 442 } |
443 | 443 |
444 } // namespace browser_sync | 444 } // namespace browser_sync |
OLD | NEW |