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 <string> | 10 #include <string> |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 window_data->Set("tabs", tab_values.release()); | 328 window_data->Set("tabs", tab_values.release()); |
329 window_list->Append(window_data.release()); | 329 window_list->Append(window_data.release()); |
330 } | 330 } |
331 } | 331 } |
332 | 332 |
333 session_data->Set("windows", window_list.release()); | 333 session_data->Set("windows", window_list.release()); |
334 session_list.Append(session_data.release()); | 334 session_list.Append(session_data.release()); |
335 } | 335 } |
336 } | 336 } |
337 base::FundamentalValue tab_sync_enabled(IsTabSyncEnabled()); | 337 base::FundamentalValue tab_sync_enabled(IsTabSyncEnabled()); |
338 web_ui()->CallJavascriptFunction("setForeignSessions", session_list, | 338 web_ui()->CallJavascriptFunctionUnsafe("setForeignSessions", session_list, |
339 tab_sync_enabled); | 339 tab_sync_enabled); |
340 } | 340 } |
341 | 341 |
342 void ForeignSessionHandler::HandleOpenForeignSession( | 342 void ForeignSessionHandler::HandleOpenForeignSession( |
343 const base::ListValue* args) { | 343 const base::ListValue* args) { |
344 size_t num_args = args->GetSize(); | 344 size_t num_args = args->GetSize(); |
345 // Expect either 1 or 8 args. For restoring an entire session, only | 345 // Expect either 1 or 8 args. For restoring an entire session, only |
346 // one argument is required -- the session tag. To restore a tab, | 346 // one argument is required -- the session tag. To restore a tab, |
347 // the additional args required are the window id, the tab id, | 347 // the additional args required are the window id, the tab id, |
348 // and 4 properties of the event object (button, altKey, ctrlKey, | 348 // and 4 properties of the event object (button, altKey, ctrlKey, |
349 // metaKey, shiftKey) for determining how to open the tab. | 349 // metaKey, shiftKey) for determining how to open the tab. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 // collapsed state persists. | 430 // collapsed state persists. |
431 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 431 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
432 DictionaryPrefUpdate update(prefs, prefs::kNtpCollapsedForeignSessions); | 432 DictionaryPrefUpdate update(prefs, prefs::kNtpCollapsedForeignSessions); |
433 if (is_collapsed) | 433 if (is_collapsed) |
434 update.Get()->SetBoolean(session_tag, true); | 434 update.Get()->SetBoolean(session_tag, true); |
435 else | 435 else |
436 update.Get()->Remove(session_tag, NULL); | 436 update.Get()->Remove(session_tag, NULL); |
437 } | 437 } |
438 | 438 |
439 } // namespace browser_sync | 439 } // namespace browser_sync |
OLD | NEW |