Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: chrome/browser/sync/sessions/sessions_sync_manager.cc

Issue 316863002: Rename "managed (mode|user)" to "supervised user" (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/sync/sessions/sessions_sync_manager.h" 5 #include "chrome/browser/sync/sessions/sessions_sync_manager.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync/glue/synced_tab_delegate.h" 9 #include "chrome/browser/sync/glue/synced_tab_delegate.h"
10 #include "chrome/browser/sync/glue/synced_window_delegate.h" 10 #include "chrome/browser/sync/glue/synced_window_delegate.h"
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 session_tab->current_navigation_index = tab_delegate.GetCurrentEntryIndex(); 909 session_tab->current_navigation_index = tab_delegate.GetCurrentEntryIndex();
910 session_tab->pinned = tab_delegate.IsPinned(); 910 session_tab->pinned = tab_delegate.IsPinned();
911 session_tab->extension_app_id = tab_delegate.GetExtensionAppId(); 911 session_tab->extension_app_id = tab_delegate.GetExtensionAppId();
912 session_tab->user_agent_override.clear(); 912 session_tab->user_agent_override.clear();
913 session_tab->timestamp = mtime; 913 session_tab->timestamp = mtime;
914 const int current_index = tab_delegate.GetCurrentEntryIndex(); 914 const int current_index = tab_delegate.GetCurrentEntryIndex();
915 const int pending_index = tab_delegate.GetPendingEntryIndex(); 915 const int pending_index = tab_delegate.GetPendingEntryIndex();
916 const int min_index = std::max(0, current_index - kMaxSyncNavigationCount); 916 const int min_index = std::max(0, current_index - kMaxSyncNavigationCount);
917 const int max_index = std::min(current_index + kMaxSyncNavigationCount, 917 const int max_index = std::min(current_index + kMaxSyncNavigationCount,
918 tab_delegate.GetEntryCount()); 918 tab_delegate.GetEntryCount());
919 bool is_managed = tab_delegate.ProfileIsManaged(); 919 bool is_supervised = tab_delegate.ProfileIsSupervised();
920 session_tab->navigations.clear(); 920 session_tab->navigations.clear();
921 921
922 for (int i = min_index; i < max_index; ++i) { 922 for (int i = min_index; i < max_index; ++i) {
923 const NavigationEntry* entry = (i == pending_index) ? 923 const NavigationEntry* entry = (i == pending_index) ?
924 tab_delegate.GetPendingEntry() : tab_delegate.GetEntryAtIndex(i); 924 tab_delegate.GetPendingEntry() : tab_delegate.GetEntryAtIndex(i);
925 DCHECK(entry); 925 DCHECK(entry);
926 if (!entry->GetVirtualURL().is_valid()) 926 if (!entry->GetVirtualURL().is_valid())
927 continue; 927 continue;
928 928
929 session_tab->navigations.push_back( 929 session_tab->navigations.push_back(
930 SerializedNavigationEntry::FromNavigationEntry(i, *entry)); 930 SerializedNavigationEntry::FromNavigationEntry(i, *entry));
931 if (is_managed) { 931 if (is_supervised) {
932 session_tab->navigations.back().set_blocked_state( 932 session_tab->navigations.back().set_blocked_state(
933 SerializedNavigationEntry::STATE_ALLOWED); 933 SerializedNavigationEntry::STATE_ALLOWED);
934 } 934 }
935 } 935 }
936 936
937 if (is_managed) { 937 if (is_supervised) {
938 const std::vector<const NavigationEntry*>& blocked_navigations = 938 const std::vector<const NavigationEntry*>& blocked_navigations =
939 *tab_delegate.GetBlockedNavigations(); 939 *tab_delegate.GetBlockedNavigations();
940 int offset = session_tab->navigations.size(); 940 int offset = session_tab->navigations.size();
941 for (size_t i = 0; i < blocked_navigations.size(); ++i) { 941 for (size_t i = 0; i < blocked_navigations.size(); ++i) {
942 session_tab->navigations.push_back( 942 session_tab->navigations.push_back(
943 SerializedNavigationEntry::FromNavigationEntry( 943 SerializedNavigationEntry::FromNavigationEntry(
944 i + offset, *blocked_navigations[i])); 944 i + offset, *blocked_navigations[i]));
945 session_tab->navigations.back().set_blocked_state( 945 session_tab->navigations.back().set_blocked_state(
946 SerializedNavigationEntry::STATE_BLOCKED); 946 SerializedNavigationEntry::STATE_BLOCKED);
947 // TODO(bauerb): Add categories 947 // TODO(bauerb): Add categories
(...skipping 27 matching lines...) Expand all
975 << " with age " << session_age_in_days << ", deleting."; 975 << " with age " << session_age_in_days << ", deleting.";
976 DeleteForeignSessionInternal(session_tag, &changes); 976 DeleteForeignSessionInternal(session_tag, &changes);
977 } 977 }
978 } 978 }
979 979
980 if (!changes.empty()) 980 if (!changes.empty())
981 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); 981 sync_processor_->ProcessSyncChanges(FROM_HERE, changes);
982 } 982 }
983 983
984 }; // namespace browser_sync 984 }; // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698