Skip to content

Commit

Permalink
Removed kOTRStashStatePathSystemBackupExcluded
Browse files Browse the repository at this point in the history
Removed the previous related upgrade path that was setting the
"do not backup" bit to YES for OTR state stash path.

Also, changed the AddSkipSystemBackupAttributeToItem to take a
boolean which gives us better flexibility in order to control the
"do not backup" bit.

Review URL: https://codereview.chromium.org/1511443002

Cr-Commit-Position: refs/heads/master@{#365671}
  • Loading branch information
shreyasv authored and Commit bot committed Dec 16, 2015
1 parent 31e3263 commit 20be8f7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 23 deletions.
12 changes: 5 additions & 7 deletions ios/chrome/browser/file_metadata_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@

#include "base/files/file_path.h"

namespace file_metadata_util {
// Synchronously sets a bit on the file system that informs the system whether
// iCloud/iTunes backups of the file/folder at |path| should be excluded or not.
// There must be a file/folder present at |path|.
void SetSkipSystemBackupAttributeToItem(const base::FilePath& path,
bool skip_system_backup);

// Synchronously sets a bit on the file system that prevents iCloud/iTunes
// backups of the file/folder at |path|. There must be a file/folder present at
// |path|.
void AddSkipSystemBackupAttributeToItem(const base::FilePath& path);

} // namespace file_metadata_util

#endif // IOS_CHROME_BROWSER_FILE_METADATA_UTIL_H_
8 changes: 3 additions & 5 deletions ios/chrome/browser/file_metadata_util.mm
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@
#include "base/strings/sys_string_conversions.h"
#include "base/threading/thread_restrictions.h"

namespace file_metadata_util {

void AddSkipSystemBackupAttributeToItem(const base::FilePath& path) {
void SetSkipSystemBackupAttributeToItem(const base::FilePath& path,
bool skip_system_backup) {
base::ThreadRestrictions::AssertIOAllowed();

NSURL* file_url =
[NSURL fileURLWithPath:base::SysUTF8ToNSString(path.value())];
DCHECK([[NSFileManager defaultManager] fileExistsAtPath:file_url.path]);

NSError* error = nil;
BOOL success = [file_url setResourceValue:@YES
BOOL success = [file_url setResourceValue:(skip_system_backup ? @YES : @NO)
forKey:NSURLIsExcludedFromBackupKey
error:&error];
if (!success) {
LOG(ERROR) << [[error description] UTF8String];
}
}

} // namespace file_metadata_util
6 changes: 0 additions & 6 deletions ios/chrome/browser/pref_names.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ const char kMetricsReportingWifiOnly[] =
// Which page should be visible on the new tab page v4
const char kNtpShownPage[] = "ntp.shown_page";

// Boolean which indicates if the user has already set a "do not backup" bit to
// the OTR Profiles's state stash path to ensure that the folder is not
// automatically synced to iCloud/iTunes.
const char kOTRStashStatePathSystemBackupExcluded[] =
"ios.otr_stash_state_path_system_backup_excluded";

// Boolean controlling whether history saving is disabled.
const char kSavingBrowserHistoryDisabled[] = "history.saving_disabled";

Expand Down
1 change: 0 additions & 1 deletion ios/chrome/browser/pref_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ extern const char kLastSessionExitedCleanly[];
extern const char kLastSessionUsedWKWebViewControlGroup[];
extern const char kMetricsReportingWifiOnly[];
extern const char kNtpShownPage[];
extern const char kOTRStashStatePathSystemBackupExcluded[];
extern const char kSavingBrowserHistoryDisabled[];
extern const char kSearchSuggestEnabled[];

Expand Down
4 changes: 0 additions & 4 deletions ios/chrome/browser/prefs/browser_prefs.mm
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ void RegisterLocalStatePrefs(PrefRegistrySimple* registry) {

data_reduction_proxy::RegisterPrefs(registry);

// TODO(shreyasv): Remove this in M49 as almost all users would have the
// "do not backup" bit set by then. crbug.com/489865.
registry->RegisterBooleanPref(prefs::kOTRStashStatePathSystemBackupExcluded,
false);
registry->RegisterBooleanPref(prefs::kBrowsingDataMigrationHasBeenPossible,
false);

Expand Down

0 comments on commit 20be8f7

Please sign in to comment.