| 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 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
| 31 #include "components/pref_registry/pref_registry_syncable.h" | 31 #include "components/pref_registry/pref_registry_syncable.h" |
| 32 #include "content/public/browser/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
| 33 #include "content/public/browser/notification_source.h" | 33 #include "content/public/browser/notification_source.h" |
| 34 #include "content/public/browser/url_data_source.h" | 34 #include "content/public/browser/url_data_source.h" |
| 35 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
| 36 #include "content/public/browser/web_ui.h" | 36 #include "content/public/browser/web_ui.h" |
| 37 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
| 38 #include "ui/base/l10n/time_format.h" | 38 #include "ui/base/l10n/time_format.h" |
| 39 #include "ui/base/webui/web_ui_util.h" | 39 #include "ui/base/webui/web_ui_util.h" |
| 40 #include "ui/gfx/host_desktop_type.h" |
| 40 | 41 |
| 41 namespace browser_sync { | 42 namespace browser_sync { |
| 42 | 43 |
| 43 namespace { | 44 namespace { |
| 44 | 45 |
| 45 // Maximum number of sessions we're going to display on the NTP | 46 // Maximum number of sessions we're going to display on the NTP |
| 46 const size_t kMaxSessionsToShow = 10; | 47 const size_t kMaxSessionsToShow = 10; |
| 47 | 48 |
| 48 // Helper method to create JSON compatible objects from Session objects. | 49 // Helper method to create JSON compatible objects from Session objects. |
| 49 scoped_ptr<base::DictionaryValue> SessionTabToValue( | 50 scoped_ptr<base::DictionaryValue> SessionTabToValue( |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 // collapsed state persists. | 442 // collapsed state persists. |
| 442 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 443 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
| 443 DictionaryPrefUpdate update(prefs, prefs::kNtpCollapsedForeignSessions); | 444 DictionaryPrefUpdate update(prefs, prefs::kNtpCollapsedForeignSessions); |
| 444 if (is_collapsed) | 445 if (is_collapsed) |
| 445 update.Get()->SetBoolean(session_tag, true); | 446 update.Get()->SetBoolean(session_tag, true); |
| 446 else | 447 else |
| 447 update.Get()->Remove(session_tag, NULL); | 448 update.Get()->Remove(session_tag, NULL); |
| 448 } | 449 } |
| 449 | 450 |
| 450 } // namespace browser_sync | 451 } // namespace browser_sync |
| OLD | NEW |