Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ios/chrome/browser/snapshots/snapshots_util.h" | 5 #include "ios/chrome/browser/snapshots/snapshots_util.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/ios/ios_util.h" | 10 #include "base/ios/ios_util.h" |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 web::WebThread::PostBlockingPoolTask( | 33 web::WebThread::PostBlockingPoolTask( |
| 34 FROM_HERE, | 34 FROM_HERE, |
| 35 base::Bind(base::IgnoreResult(&base::DeleteFile), snapshotPath, false)); | 35 base::Bind(base::IgnoreResult(&base::DeleteFile), snapshotPath, false)); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 | 38 |
| 39 void GetSnapshotsPaths(std::vector<base::FilePath>* snapshotsPaths) { | 39 void GetSnapshotsPaths(std::vector<base::FilePath>* snapshotsPaths) { |
| 40 DCHECK(snapshotsPaths); | 40 DCHECK(snapshotsPaths); |
| 41 base::FilePath snapshotsDir; | 41 base::FilePath snapshotsDir; |
| 42 PathService::Get(base::DIR_CACHE, &snapshotsDir); | 42 PathService::Get(base::DIR_CACHE, &snapshotsDir); |
| 43 // Snapshots are located in a path with the bundle ID used twice. | |
| 43 snapshotsDir = | 44 snapshotsDir = |
| 44 snapshotsDir.Append("Snapshots").Append(base::mac::BaseBundleID()); | 45 snapshotsDir.Append("Snapshots").Append(base::mac::BaseBundleID()); |
|
sdefresne
2016/10/19 18:22:27
nit: (or however "git cl format" format this)
sna
pkl (ping after 24h if needed)
2016/10/19 20:35:03
git cl format'ed
| |
| 45 if (base::ios::IsRunningOnIOS8OrLater()) { | 46 snapshotsDir = snapshotsDir.Append(base::mac::BaseBundleID()); |
| 46 // On iOS8, the snapshots are located in a path with the bundle ID used | |
| 47 // twice. | |
| 48 snapshotsDir = snapshotsDir.Append(base::mac::BaseBundleID()); | |
| 49 } else { | |
| 50 // On iOS7, the snapshots are located in the subfolder "Main". | |
| 51 snapshotsDir = snapshotsDir.Append("Main"); | |
| 52 } | |
| 53 const char* retinaSuffix = ""; | 47 const char* retinaSuffix = ""; |
| 54 CGFloat scale = [UIScreen mainScreen].scale; | 48 CGFloat scale = [UIScreen mainScreen].scale; |
| 55 if (scale == 2) { | 49 if (scale == 2) { |
| 56 retinaSuffix = "@2x"; | 50 retinaSuffix = "@2x"; |
| 57 } else if (scale == 3) { | 51 } else if (scale == 3) { |
| 58 retinaSuffix = "@3x"; | 52 retinaSuffix = "@3x"; |
| 59 } | 53 } |
| 60 for (unsigned int i = 0; i < arraysize(kOrientationDescriptions); i++) { | 54 for (unsigned int i = 0; i < arraysize(kOrientationDescriptions); i++) { |
| 61 std::string snapshotFilename = | 55 std::string snapshotFilename = |
| 62 base::StringPrintf("UIApplicationAutomaticSnapshotDefault-%s%s.png", | 56 base::StringPrintf("UIApplicationAutomaticSnapshotDefault-%s%s.png", |
| 63 kOrientationDescriptions[i], retinaSuffix); | 57 kOrientationDescriptions[i], retinaSuffix); |
| 64 base::FilePath snapshotPath = snapshotsDir.Append(snapshotFilename); | 58 base::FilePath snapshotPath = snapshotsDir.Append(snapshotFilename); |
| 65 snapshotsPaths->push_back(snapshotPath); | 59 snapshotsPaths->push_back(snapshotPath); |
| 66 } | 60 } |
| 67 } | 61 } |
| OLD | NEW |