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

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_settings_handler.cc

Issue 580363002: Update app info and install prompt UI to show retained devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed feedback from Avi and tapted. Created 6 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/ui/webui/extensions/extension_settings_handler.h" 5 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h"
6 6
7 #include "apps/app_load_service.h" 7 #include "apps/app_load_service.h"
8 #include "apps/saved_devices_service.h"
8 #include "apps/saved_files_service.h" 9 #include "apps/saved_files_service.h"
9 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
10 #include "base/base64.h" 11 #include "base/base64.h"
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
13 #include "base/command_line.h" 14 #include "base/command_line.h"
14 #include "base/location.h" 15 #include "base/location.h"
15 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
16 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
17 #include "base/prefs/pref_service.h" 18 #include "base/prefs/pref_service.h"
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 } 791 }
791 792
792 void ExtensionSettingsHandler::ExtensionUninstallCanceled() { 793 void ExtensionSettingsHandler::ExtensionUninstallCanceled() {
793 extension_id_prompting_ = ""; 794 extension_id_prompting_ = "";
794 } 795 }
795 796
796 void ExtensionSettingsHandler::ExtensionWarningsChanged() { 797 void ExtensionSettingsHandler::ExtensionWarningsChanged() {
797 MaybeUpdateAfterNotification(); 798 MaybeUpdateAfterNotification();
798 } 799 }
799 800
800 // This is called when the user clicks "Revoke File Access." 801 // This is called when the user clicks "Revoke File/Device Access."
801 void ExtensionSettingsHandler::InstallUIProceed() { 802 void ExtensionSettingsHandler::InstallUIProceed() {
802 Profile* profile = Profile::FromWebUI(web_ui()); 803 Profile* profile = Profile::FromWebUI(web_ui());
804 apps::SavedDevicesService::Get(profile)->Clear(extension_id_prompting_);
803 apps::SavedFilesService::Get(profile)->ClearQueue( 805 apps::SavedFilesService::Get(profile)->ClearQueue(
804 extension_service_->GetExtensionById(extension_id_prompting_, true)); 806 extension_service_->GetExtensionById(extension_id_prompting_, true));
805 apps::AppLoadService::Get(profile) 807 apps::AppLoadService::Get(profile)
806 ->RestartApplicationIfRunning(extension_id_prompting_); 808 ->RestartApplicationIfRunning(extension_id_prompting_);
807 extension_id_prompting_.clear(); 809 extension_id_prompting_.clear();
808 } 810 }
809 811
810 void ExtensionSettingsHandler::InstallUIAbort(bool user_initiated) { 812 void ExtensionSettingsHandler::InstallUIAbort(bool user_initiated) {
811 extension_id_prompting_.clear(); 813 extension_id_prompting_.clear();
812 } 814 }
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 std::vector<base::FilePath> retained_file_paths; 1158 std::vector<base::FilePath> retained_file_paths;
1157 if (extension->permissions_data()->HasAPIPermission( 1159 if (extension->permissions_data()->HasAPIPermission(
1158 APIPermission::kFileSystem)) { 1160 APIPermission::kFileSystem)) {
1159 std::vector<apps::SavedFileEntry> retained_file_entries = 1161 std::vector<apps::SavedFileEntry> retained_file_entries =
1160 apps::SavedFilesService::Get(Profile::FromWebUI( 1162 apps::SavedFilesService::Get(Profile::FromWebUI(
1161 web_ui()))->GetAllFileEntries(extension_id_prompting_); 1163 web_ui()))->GetAllFileEntries(extension_id_prompting_);
1162 for (size_t i = 0; i < retained_file_entries.size(); ++i) { 1164 for (size_t i = 0; i < retained_file_entries.size(); ++i) {
1163 retained_file_paths.push_back(retained_file_entries[i].path); 1165 retained_file_paths.push_back(retained_file_entries[i].path);
1164 } 1166 }
1165 } 1167 }
1168 std::vector<base::string16> retained_device_messages;
1169 if (extension->permissions_data()->HasAPIPermission(APIPermission::kUsb)) {
1170 retained_device_messages =
1171 apps::SavedDevicesService::Get(Profile::FromWebUI(web_ui()))
1172 ->GetPermissionMessageStrings(extension_id_prompting_);
1173 }
1174
1166 // The BrokerDelegate manages its own lifetime. 1175 // The BrokerDelegate manages its own lifetime.
1167 prompt_->ReviewPermissions( 1176 prompt_->ReviewPermissions(new BrokerDelegate(AsWeakPtr()),
1168 new BrokerDelegate(AsWeakPtr()), extension, retained_file_paths); 1177 extension,
1178 retained_file_paths,
1179 retained_device_messages);
1169 } 1180 }
1170 1181
1171 void ExtensionSettingsHandler::HandleShowButtonMessage( 1182 void ExtensionSettingsHandler::HandleShowButtonMessage(
1172 const base::ListValue* args) { 1183 const base::ListValue* args) {
1173 const Extension* extension = GetActiveExtension(args); 1184 const Extension* extension = GetActiveExtension(args);
1174 if (!extension) 1185 if (!extension)
1175 return; 1186 return;
1176 ExtensionActionAPI::SetBrowserActionVisibility( 1187 ExtensionActionAPI::SetBrowserActionVisibility(
1177 ExtensionPrefs::Get(extension_service_->profile()), 1188 ExtensionPrefs::Get(extension_service_->profile()),
1178 extension->id(), 1189 extension->id(),
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 extension_service_->EnableExtension(extension_id); 1428 extension_service_->EnableExtension(extension_id);
1418 } else { 1429 } else {
1419 ExtensionErrorReporter::GetInstance()->ReportError( 1430 ExtensionErrorReporter::GetInstance()->ReportError(
1420 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), 1431 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')),
1421 true); // Be noisy. 1432 true); // Be noisy.
1422 } 1433 }
1423 requirements_checker_.reset(); 1434 requirements_checker_.reset();
1424 } 1435 }
1425 1436
1426 } // namespace extensions 1437 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698