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

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

Issue 382133003: Refactored ExtensionUninstallDialog to take a NativeWindow instead of a Browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_storage_monitor.h" 5 #include "chrome/browser/extensions/extension_storage_monitor.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/extension_storage_monitor_factory.h" 14 #include "chrome/browser/extensions/extension_storage_monitor_factory.h"
15 #include "chrome/browser/extensions/extension_util.h" 15 #include "chrome/browser/extensions/extension_util.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/app_list/app_list_service.h"
18 #include "chrome/browser/ui/host_desktop.h"
17 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 19 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
18 #include "content/public/browser/browser_context.h" 20 #include "content/public/browser/browser_context.h"
19 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/notification_details.h" 22 #include "content/public/browser/notification_details.h"
21 #include "content/public/browser/notification_source.h" 23 #include "content/public/browser/notification_source.h"
22 #include "content/public/browser/storage_partition.h" 24 #include "content/public/browser/storage_partition.h"
23 #include "extensions/browser/extension_prefs.h" 25 #include "extensions/browser/extension_prefs.h"
24 #include "extensions/browser/extension_registry.h" 26 #include "extensions/browser/extension_registry.h"
25 #include "extensions/browser/extension_system.h" 27 #include "extensions/browser/extension_system.h"
26 #include "extensions/browser/image_loader.h" 28 #include "extensions/browser/image_loader.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 notified_extension_ids_.clear(); 542 notified_extension_ids_.clear();
541 } 543 }
542 544
543 void ExtensionStorageMonitor::ShowUninstallPrompt( 545 void ExtensionStorageMonitor::ShowUninstallPrompt(
544 const std::string& extension_id) { 546 const std::string& extension_id) {
545 const Extension* extension = GetExtensionById(context_, extension_id); 547 const Extension* extension = GetExtensionById(context_, extension_id);
546 if (!extension) 548 if (!extension)
547 return; 549 return;
548 550
549 if (!uninstall_dialog_.get()) { 551 if (!uninstall_dialog_.get()) {
550 uninstall_dialog_.reset(ExtensionUninstallDialog::Create( 552 // TODO(sashab,tapted): A true |desktop_type| needs to be passed in at
551 Profile::FromBrowserContext(context_), NULL, this)); 553 // creation time to remove reliance on GetActiveDesktop(). See
554 // http://crbug.com/308360.
555 uninstall_dialog_.reset(ExtensionUninstallDialog::CreateForNonBrowserWindow(
556 Profile::FromBrowserContext(context_),
557 AppListService::Get(chrome::GetActiveDesktop())->GetAppListWindow(),
tapted 2014/07/11 04:39:15 I don't think this call site is intending to use t
sashab 2014/07/11 05:58:57 Done.
tmdiep 2014/07/11 06:13:29 Yep, this isn't related to the app launcher. The u
558 this));
552 } 559 }
553 560
554 uninstall_extension_id_ = extension->id(); 561 uninstall_extension_id_ = extension->id();
555 uninstall_dialog_->ConfirmUninstall(extension); 562 uninstall_dialog_->ConfirmUninstall(extension);
556 } 563 }
557 564
558 int64 ExtensionStorageMonitor::GetNextStorageThreshold( 565 int64 ExtensionStorageMonitor::GetNextStorageThreshold(
559 const std::string& extension_id) const { 566 const std::string& extension_id) const {
560 int next_threshold = GetNextStorageThresholdFromPrefs(extension_id); 567 int next_threshold = GetNextStorageThresholdFromPrefs(extension_id);
561 if (next_threshold == 0) { 568 if (next_threshold == 0) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 void ExtensionStorageMonitor::SetStorageNotificationEnabled( 616 void ExtensionStorageMonitor::SetStorageNotificationEnabled(
610 const std::string& extension_id, 617 const std::string& extension_id,
611 bool enable_notifications) { 618 bool enable_notifications) {
612 extension_prefs_->UpdateExtensionPref( 619 extension_prefs_->UpdateExtensionPref(
613 extension_id, 620 extension_id,
614 kPrefDisableStorageNotifications, 621 kPrefDisableStorageNotifications,
615 enable_notifications ? NULL : new base::FundamentalValue(true)); 622 enable_notifications ? NULL : new base::FundamentalValue(true));
616 } 623 }
617 624
618 } // namespace extensions 625 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698