Commit d211f879 authored by Ewann's avatar Ewann Committed by Commit Bot

Rename google_drive_app_util. files to a more generic name

Renames google_drive_app_util. files to external_app_util. and GetFilesAppDownloadsDirectoryUrl() to  GetFilesAppUrl().
Moves GetFilesAppUrl() inside external_app_util.

Bug: 1052851
Change-Id: I15195179615bba4c891e66443d1518f02eacd4c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2090416Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Ewann Pellé <ewannpv@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747735}
parent 0dc812eb
......@@ -17,8 +17,8 @@ source_set("download") {
"download_manager_tab_helper.h",
"download_manager_tab_helper.mm",
"download_manager_tab_helper_delegate.h",
"google_drive_app_util.h",
"google_drive_app_util.mm",
"external_app_util.h",
"external_app_util.mm",
"pass_kit_tab_helper.h",
"pass_kit_tab_helper.mm",
"pass_kit_tab_helper_delegate.h",
......
......@@ -19,8 +19,4 @@ bool GetDownloadsDirectory(base::FilePath* directory_path);
// Asynchronously deletes downloads directory.
void DeleteDownloadsDirectory();
// Returns URL which can be used to open Chrome's directory in files.app.
// Returns nil if it cannot get the directory.
NSURL* GetFilesAppDownloadsDirectoryUrl();
#endif // IOS_CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DIRECTORY_UTIL_H_
......@@ -52,14 +52,3 @@ void DeleteDownloadsDirectory() {
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::BindOnce(&DeleteDownloadsDirectorySync));
}
NSURL* GetFilesAppDownloadsDirectoryUrl() {
base::FilePath download_dir;
if (!GetDownloadsDirectory(&download_dir)) {
return nil;
}
return [NSURL
URLWithString:[NSString stringWithFormat:@"shareddocuments://%s",
download_dir.value().c_str()]];
}
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_DOWNLOAD_GOOGLE_DRIVE_APP_UTIL_H_
#define IOS_CHROME_BROWSER_DOWNLOAD_GOOGLE_DRIVE_APP_UTIL_H_
#ifndef IOS_CHROME_BROWSER_DOWNLOAD_EXTERNAL_APP_UTIL_H_
#define IOS_CHROME_BROWSER_DOWNLOAD_EXTERNAL_APP_UTIL_H_
@class NSString;
@class NSURL;
......@@ -26,4 +26,8 @@ NSURL* GetGoogleDriveAppUrl();
// Returns true if Google Drive app is installed.
bool IsGoogleDriveAppInstalled();
#endif // IOS_CHROME_BROWSER_DOWNLOAD_GOOGLE_DRIVE_APP_UTIL_H_
// Returns URL which can be used to open Chrome's directory in files.app.
// Returns nil if it cannot get the directory.
NSURL* GetFilesAppUrl();
#endif // IOS_CHROME_BROWSER_DOWNLOAD_EXTERNAL_APP_UTIL_H_
......@@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/download/google_drive_app_util.h"
#import "ios/chrome/browser/download/external_app_util.h"
#import <UIKit/UIKit.h>
#include "base/files/file_path.h"
#include "ios/chrome/browser/download/download_directory_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
......@@ -23,3 +26,14 @@ NSURL* GetGoogleDriveAppUrl() {
bool IsGoogleDriveAppInstalled() {
return [[UIApplication sharedApplication] canOpenURL:GetGoogleDriveAppUrl()];
}
NSURL* GetFilesAppUrl() {
base::FilePath download_dir;
if (!GetDownloadsDirectory(&download_dir)) {
return nil;
}
return [NSURL
URLWithString:[NSString stringWithFormat:@"shareddocuments://%s",
download_dir.value().c_str()]];
}
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/download/google_drive_app_util.h"
#import "ios/chrome/browser/download/external_app_util.h"
#import <UIKit/UIKit.h>
......
......@@ -14,6 +14,7 @@
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/chrome_url_constants.h"
#include "ios/chrome/browser/download/download_directory_util.h"
#import "ios/chrome/browser/download/external_app_util.h"
#import "ios/chrome/browser/download/pass_kit_tab_helper.h"
#import "ios/chrome/browser/find_in_page/find_tab_helper.h"
#import "ios/chrome/browser/main/browser.h"
......@@ -514,7 +515,7 @@
- (void)showDownloadsFolder {
if (base::FeatureList::IsEnabled(kOpenDownloadsInFilesApp)) {
NSURL* URL = GetFilesAppDownloadsDirectoryUrl();
NSURL* URL = GetFilesAppUrl();
if (!URL)
return;
......
......@@ -7,6 +7,7 @@
#include "base/files/file_util.h"
#include "base/test/scoped_feature_list.h"
#include "ios/chrome/browser/download/download_directory_util.h"
#import "ios/chrome/browser/download/external_app_util.h"
#include "ios/chrome/browser/main/test_browser.h"
#import "ios/chrome/browser/ui/commands/browser_coordinator_commands.h"
#import "ios/chrome/browser/ui/commands/command_dispatcher.h"
......@@ -47,7 +48,7 @@ TEST_F(BrowserCoordinatorTest, ShowDownloadsFolder) {
base::FilePath download_dir;
ASSERT_TRUE(GetDownloadsDirectory(&download_dir));
NSURL* url = GetFilesAppDownloadsDirectoryUrl();
NSURL* url = GetFilesAppUrl();
ASSERT_TRUE(url);
UIApplication* shared_application = [UIApplication sharedApplication];
......
......@@ -18,7 +18,7 @@
#include "components/strings/grit/components_strings.h"
#include "ios/chrome/browser/download/download_manager_metric_names.h"
#import "ios/chrome/browser/download/download_manager_tab_helper.h"
#import "ios/chrome/browser/download/google_drive_app_util.h"
#import "ios/chrome/browser/download/external_app_util.h"
#import "ios/chrome/browser/installation_notifier.h"
#import "ios/chrome/browser/main/browser.h"
#import "ios/chrome/browser/store_kit/store_kit_coordinator.h"
......
......@@ -18,7 +18,7 @@
#include "ios/chrome/browser/download/download_directory_util.h"
#include "ios/chrome/browser/download/download_manager_metric_names.h"
#import "ios/chrome/browser/download/download_manager_tab_helper.h"
#import "ios/chrome/browser/download/google_drive_app_util.h"
#import "ios/chrome/browser/download/external_app_util.h"
#include "ios/chrome/browser/main/test_browser.h"
#import "ios/chrome/browser/ui/download/download_manager_view_controller.h"
#import "ios/chrome/browser/web_state_list/fake_web_state_list_delegate.h"
......
......@@ -14,7 +14,7 @@
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "ios/chrome/browser/download/download_directory_util.h"
#import "ios/chrome/browser/download/google_drive_app_util.h"
#import "ios/chrome/browser/download/external_app_util.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/web/public/download/download_task.h"
#include "net/base/net_errors.h"
......
......@@ -10,7 +10,7 @@
#include "base/strings/sys_string_conversions.h"
#import "base/test/ios/wait_util.h"
#include "ios/chrome/browser/download/download_directory_util.h"
#import "ios/chrome/browser/download/google_drive_app_util.h"
#import "ios/chrome/browser/download/external_app_util.h"
#import "ios/chrome/test/fakes/fake_download_manager_consumer.h"
#import "ios/web/public/test/fakes/fake_download_task.h"
#include "ios/web/public/test/web_task_environment.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment