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

Side by Side Diff: ios/chrome/browser/snapshots/snapshots_util.mm

Issue 2426823002: Removed use of IsRunningOnIOS8OrLater from snapshots code. (Closed)
Patch Set: addressed comments from sdefresne Created 4 years, 2 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
OLDNEW
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
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 snapshotsDir = 43 // Snapshots are located in a path with the bundle ID used twice.
44 snapshotsDir.Append("Snapshots").Append(base::mac::BaseBundleID()); 44 snapshotsDir = snapshotsDir.Append("Snapshots")
45 if (base::ios::IsRunningOnIOS8OrLater()) { 45 .Append(base::mac::BaseBundleID())
46 // On iOS8, the snapshots are located in a path with the bundle ID used 46 .Append(base::mac::BaseBundleID());
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 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/snapshots/snapshot_cache_unittest.mm ('k') | ios/chrome/browser/snapshots/snapshots_util_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698