Chromium Code Reviews| 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 6c10faf01acd189f6a6843c1dde087faf40ffa10..e12513dd58d704adeb0dd022861a190bf9ce3cf2 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 user. |
|
benwells
2015/04/07 08:31:33
Nit: s/ask/ask or inform the/
mtomasz
2015/04/08 00:30:46
Done.
|
| + 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; |
| @@ -1269,7 +1281,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; |