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

Side by Side Diff: chrome/browser/extensions/extension_disabled_ui.cc

Issue 2396903002: Supervised Users always need custodian approval for permission increase (Closed)
Patch Set: Remove deleted method from the header file. Created 4 years, 2 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/extensions/extension_disabled_ui.h" 5 #include "chrome/browser/extensions/extension_disabled_ui.h"
6 6
7 #include <bitset> 7 #include <bitset>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } 312 }
313 for (const PermissionMessage& msg : permission_warnings) { 313 for (const PermissionMessage& msg : permission_warnings) {
314 messages.push_back(l10n_util::GetStringFUTF16(IDS_EXTENSION_PERMISSION_LINE, 314 messages.push_back(l10n_util::GetStringFUTF16(IDS_EXTENSION_PERMISSION_LINE,
315 msg.message())); 315 msg.message()));
316 } 316 }
317 return messages; 317 return messages;
318 } 318 }
319 319
320 base::string16 ExtensionDisabledGlobalError::GetBubbleViewAcceptButtonLabel() { 320 base::string16 ExtensionDisabledGlobalError::GetBubbleViewAcceptButtonLabel() {
321 if (extensions::util::IsExtensionSupervised(extension_, 321 if (extensions::util::IsExtensionSupervised(extension_,
322 service_->profile()) && 322 service_->profile())) {
323 extensions::util::NeedCustodianApprovalForPermissionIncrease(
324 service_->profile())) {
325 // TODO(treib): Probably use a new string here once we get UX design. 323 // TODO(treib): Probably use a new string here once we get UX design.
326 // For now, just use "OK". crbug.com/461261 324 // For now, just use "OK". crbug.com/461261
327 return l10n_util::GetStringUTF16(IDS_OK); 325 return l10n_util::GetStringUTF16(IDS_OK);
328 } 326 }
329 if (is_remote_install_) { 327 if (is_remote_install_) {
330 return l10n_util::GetStringUTF16( 328 return l10n_util::GetStringUTF16(
331 extension_->is_app() 329 extension_->is_app()
332 ? IDS_EXTENSION_PROMPT_REMOTE_INSTALL_BUTTON_APP 330 ? IDS_EXTENSION_PROMPT_REMOTE_INSTALL_BUTTON_APP
333 : IDS_EXTENSION_PROMPT_REMOTE_INSTALL_BUTTON_EXTENSION); 331 : IDS_EXTENSION_PROMPT_REMOTE_INSTALL_BUTTON_EXTENSION);
334 } 332 }
335 return l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_RE_ENABLE_BUTTON); 333 return l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_RE_ENABLE_BUTTON);
336 } 334 }
337 335
338 base::string16 ExtensionDisabledGlobalError::GetBubbleViewCancelButtonLabel() { 336 base::string16 ExtensionDisabledGlobalError::GetBubbleViewCancelButtonLabel() {
339 if (extensions::util::IsExtensionSupervised(extension_, 337 if (extensions::util::IsExtensionSupervised(extension_,
340 service_->profile())) { 338 service_->profile())) {
341 if (extensions::util::NeedCustodianApprovalForPermissionIncrease( 339 // The supervised user can't approve the update, and hence there is no
342 service_->profile())) { 340 // "cancel" button. Return an empty string such that the "cancel" button
343 // If the supervised user can't approve the update, then there is no 341 // is not shown in the dialog.
344 // "cancel" button. 342 return base::string16();
345 return base::string16();
346 } else {
347 // Supervised users can not remove extensions, so use "cancel" here
348 // instead of "uninstall".
349 return l10n_util::GetStringUTF16(IDS_CANCEL);
350 }
351 } 343 }
352 return l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL); 344 return l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL);
353 } 345 }
354 346
355 void ExtensionDisabledGlobalError::OnBubbleViewDidClose(Browser* browser) { 347 void ExtensionDisabledGlobalError::OnBubbleViewDidClose(Browser* browser) {
356 } 348 }
357 349
358 void ExtensionDisabledGlobalError::BubbleViewAcceptButtonPressed( 350 void ExtensionDisabledGlobalError::BubbleViewAcceptButtonPressed(
359 Browser* browser) { 351 Browser* browser) {
360 if (extensions::util::IsExtensionSupervised(extension_, 352 if (extensions::util::IsExtensionSupervised(extension_,
361 service_->profile()) && 353 service_->profile())) {
362 extensions::util::NeedCustodianApprovalForPermissionIncrease(
363 service_->profile())) {
364 return; 354 return;
365 } 355 }
366 // Delay extension reenabling so this bubble closes properly. 356 // Delay extension reenabling so this bubble closes properly.
367 base::ThreadTaskRunnerHandle::Get()->PostTask( 357 base::ThreadTaskRunnerHandle::Get()->PostTask(
368 FROM_HERE, 358 FROM_HERE,
369 base::Bind(&ExtensionService::GrantPermissionsAndEnableExtension, 359 base::Bind(&ExtensionService::GrantPermissionsAndEnableExtension,
370 service_->AsWeakPtr(), extension_)); 360 service_->AsWeakPtr(), extension_));
371 } 361 }
372 362
373 void ExtensionDisabledGlobalError::BubbleViewCancelButtonPressed( 363 void ExtensionDisabledGlobalError::BubbleViewCancelButtonPressed(
374 Browser* browser) { 364 Browser* browser) {
375 if (extensions::util::IsExtensionSupervised(extension_, 365 // For custodian-installed extensions, this button should not exist because
376 service_->profile())) { 366 // there is only an "OK" button.
377 // For custodian-installed extensions, this button should only exist if the 367 // Supervised users may never remove custodian-installed extensions.
378 // supervised user can approve the update. Otherwise there is only an "OK" 368 DCHECK(!extensions::util::IsExtensionSupervised(extension_,
379 // button. 369 service_->profile()));
380 DCHECK(!extensions::util::NeedCustodianApprovalForPermissionIncrease(
381 service_->profile()));
382 // Supervised users may never remove custodian-installed extensions.
383 return;
384 }
385 370
386 uninstall_dialog_.reset(extensions::ExtensionUninstallDialog::Create( 371 uninstall_dialog_.reset(extensions::ExtensionUninstallDialog::Create(
387 service_->profile(), browser->window()->GetNativeWindow(), this)); 372 service_->profile(), browser->window()->GetNativeWindow(), this));
388 // Delay showing the uninstall dialog, so that this function returns 373 // Delay showing the uninstall dialog, so that this function returns
389 // immediately, to close the bubble properly. See crbug.com/121544. 374 // immediately, to close the bubble properly. See crbug.com/121544.
390 base::ThreadTaskRunnerHandle::Get()->PostTask( 375 base::ThreadTaskRunnerHandle::Get()->PostTask(
391 FROM_HERE, 376 FROM_HERE,
392 base::Bind(&extensions::ExtensionUninstallDialog::ConfirmUninstall, 377 base::Bind(&extensions::ExtensionUninstallDialog::ConfirmUninstall,
393 uninstall_dialog_->AsWeakPtr(), extension_, 378 uninstall_dialog_->AsWeakPtr(), extension_,
394 extensions::UNINSTALL_REASON_EXTENSION_DISABLED, 379 extensions::UNINSTALL_REASON_EXTENSION_DISABLED,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 content::WebContents* web_contents, 477 content::WebContents* web_contents,
493 const Extension* extension) { 478 const Extension* extension) {
494 std::unique_ptr<ExtensionInstallPrompt> install_ui( 479 std::unique_ptr<ExtensionInstallPrompt> install_ui(
495 new ExtensionInstallPrompt(web_contents)); 480 new ExtensionInstallPrompt(web_contents));
496 // This object manages its own lifetime. 481 // This object manages its own lifetime.
497 new ExtensionDisabledDialogDelegate(service, std::move(install_ui), 482 new ExtensionDisabledDialogDelegate(service, std::move(install_ui),
498 extension); 483 extension);
499 } 484 }
500 485
501 } // namespace extensions 486 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/webstore_private/webstore_private_api.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698