Index: chrome/browser/extensions/api/file_system/file_system_api.cc |
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc |
index 38da52af0bc940522a84bdfc0d1477698b7140d3..47ee437c29e18265ba10a9733a890a3e4f9dc4a8 100644 |
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc |
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc |
@@ -67,6 +67,7 @@ |
#include "chrome/browser/chromeos/file_manager/app_id.h" |
#include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" |
#include "chrome/browser/extensions/api/file_system/request_file_system_dialog_view.h" |
+#include "chrome/browser/extensions/api/file_system/request_file_system_notification.h" |
#include "chrome/browser/ui/simple_message_box.h" |
#include "components/user_manager/user_manager.h" |
#include "extensions/common/constants.h" |
@@ -293,22 +294,25 @@ ConsentProvider::ConsentProvider(DelegateInterface* delegate) |
ConsentProvider::~ConsentProvider() { |
} |
-void ConsentProvider::RequestConsent(const extensions::Extension& extension, |
- base::WeakPtr<file_manager::Volume> volume, |
- bool writable, |
- const ConsentCallback& callback) { |
+void ConsentProvider::RequestConsent( |
+ const extensions::Extension& extension, |
+ const base::WeakPtr<file_manager::Volume>& volume, |
+ bool writable, |
+ const ConsentCallback& callback) { |
DCHECK(IsGrantable(extension)); |
- // If auto-launched kiosk app, then no need to ask user. |
- if (delegate_->IsAutoLaunched(extension)) { |
+ // If a whitelisted component, then no need to ask or inform the user. |
+ if (extension.location() == Manifest::COMPONENT && |
+ delegate_->IsWhitelistedComponent(extension)) { |
base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, base::Bind(callback, CONSENT_GRANTED)); |
return; |
} |
- // If a whitelisted component, then no need to ask user, either. |
- if (extension.location() == Manifest::COMPONENT && |
- delegate_->IsWhitelistedComponent(extension)) { |
+ // If auto-launched kiosk app, then no need to ask user either, but show the |
+ // notification. |
+ if (delegate_->IsAutoLaunched(extension)) { |
+ delegate_->ShowNotification(extension, volume, writable); |
base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, base::Bind(callback, CONSENT_GRANTED)); |
return; |
@@ -371,7 +375,7 @@ void ConsentProviderDelegate::SetAutoDialogButtonForTest( |
void ConsentProviderDelegate::ShowDialog( |
const extensions::Extension& extension, |
- base::WeakPtr<file_manager::Volume> volume, |
+ const base::WeakPtr<file_manager::Volume>& volume, |
bool writable, |
const file_system_api::ConsentProvider::ShowDialogCallback& callback) { |
content::WebContents* const foreground_contents = |
@@ -400,6 +404,14 @@ void ConsentProviderDelegate::ShowDialog( |
writable, base::Bind(callback)); |
} |
+void ConsentProviderDelegate::ShowNotification( |
+ const extensions::Extension& extension, |
+ const base::WeakPtr<file_manager::Volume>& volume, |
+ bool writable) { |
+ RequestFileSystemNotification::ShowAutoGrantedNotification( |
+ profile_, extension, volume, writable); |
+} |
+ |
bool ConsentProviderDelegate::IsAutoLaunched( |
const extensions::Extension& extension) { |
chromeos::KioskAppManager::App app_info; |
@@ -1270,7 +1282,7 @@ ExtensionFunction::ResponseAction FileSystemRequestFileSystemFunction::Run() { |
} |
void FileSystemRequestFileSystemFunction::OnConsentReceived( |
- base::WeakPtr<file_manager::Volume> volume, |
+ const base::WeakPtr<file_manager::Volume>& volume, |
bool writable, |
ConsentProvider::Consent result) { |
using file_manager::VolumeManager; |