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

Unified Diff: ios/chrome/browser/ui/snapshots_util.mm

Issue 862693003: Upstream //ios/chrome/browser/snapshots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/snapshots_util.h ('k') | ios/chrome/browser/ui/snapshots_util_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/snapshots_util.mm
diff --git a/ios/chrome/browser/ui/snapshots_util.mm b/ios/chrome/browser/ui/snapshots_util.mm
deleted file mode 100644
index 8b9c4fc99dd77b04706ed340ed21362e05fa4107..0000000000000000000000000000000000000000
--- a/ios/chrome/browser/ui/snapshots_util.mm
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ios/chrome/browser/ui/snapshots_util.h"
-
-#import <UIKit/UIKit.h>
-
-#include "base/files/file_util.h"
-#include "base/ios/ios_util.h"
-#include "base/location.h"
-#include "base/mac/foundation_util.h"
-#include "base/path_service.h"
-#include "base/strings/stringprintf.h"
-#include "ios/web/public/web_thread.h"
-
-namespace {
-const char* kOrientationDescriptions[] = {
- "LandscapeLeft",
- "LandscapeRight",
- "Portrait",
- "PortraitUpsideDown",
-};
-} // namespace
-
-void ClearIOSSnapshots() {
- // Generates a list containing all the possible snapshot paths because the
- // list of snapshots stored on the device can't be obtained programmatically.
- std::vector<base::FilePath> snapshotsPaths;
- GetSnapshotsPaths(&snapshotsPaths);
- for (base::FilePath snapshotPath : snapshotsPaths) {
- web::WebThread::PostBlockingPoolTask(
- FROM_HERE,
- base::Bind(base::IgnoreResult(&base::DeleteFile), snapshotPath, false));
- }
-}
-
-void GetSnapshotsPaths(std::vector<base::FilePath>* snapshotsPaths) {
- DCHECK(snapshotsPaths);
- base::FilePath snapshotsDir;
- PathService::Get(base::DIR_CACHE, &snapshotsDir);
- snapshotsDir =
- snapshotsDir.Append("Snapshots").Append(base::mac::BaseBundleID());
- if (base::ios::IsRunningOnIOS8OrLater()) {
- // On iOS8, the snapshots are located in a path with the bundle ID used
- // twice.
- snapshotsDir = snapshotsDir.Append(base::mac::BaseBundleID());
- } else {
- // On iOS7, the snapshots are located in the subfolder "Main".
- snapshotsDir = snapshotsDir.Append("Main");
- }
- const char* retinaSuffix = "";
- CGFloat scale = [UIScreen mainScreen].scale;
- if (scale == 2) {
- retinaSuffix = "@2x";
- } else if (scale == 3) {
- retinaSuffix = "@3x";
- }
- for (unsigned int i = 0; i < arraysize(kOrientationDescriptions); i++) {
- std::string snapshotFilename =
- base::StringPrintf("UIApplicationAutomaticSnapshotDefault-%s%s.png",
- kOrientationDescriptions[i], retinaSuffix);
- base::FilePath snapshotPath = snapshotsDir.Append(snapshotFilename);
- snapshotsPaths->push_back(snapshotPath);
- }
-}
« no previous file with comments | « ios/chrome/browser/ui/snapshots_util.h ('k') | ios/chrome/browser/ui/snapshots_util_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698