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

Side by Side Diff: chrome/browser/extensions/extension_uninstall_dialog.h

Issue 307413002: Move ExtensionUninstallDialog into extensions namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_DIALOG_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_DIALOG_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_DIALOG_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_DIALOG_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
14 #include "ui/gfx/image/image_skia.h" 14 #include "ui/gfx/image/image_skia.h"
15 15
16 class Browser; 16 class Browser;
17 class Profile; 17 class Profile;
18 18
19 namespace base { 19 namespace base {
20 class MessageLoop; 20 class MessageLoop;
21 } 21 }
22 22
23 namespace extensions {
24 class Extension;
25 }
26
27 namespace gfx { 23 namespace gfx {
28 class Image; 24 class Image;
29 } 25 }
30 26
27 namespace extensions {
28 class Extension;
29
31 class ExtensionUninstallDialog 30 class ExtensionUninstallDialog
32 : public content::NotificationObserver, 31 : public content::NotificationObserver,
33 public base::SupportsWeakPtr<ExtensionUninstallDialog> { 32 public base::SupportsWeakPtr<ExtensionUninstallDialog> {
34 public: 33 public:
35 class Delegate { 34 class Delegate {
36 public: 35 public:
37 // We call this method to signal that the uninstallation should continue. 36 // We call this method to signal that the uninstallation should continue.
38 virtual void ExtensionUninstallAccepted() = 0; 37 virtual void ExtensionUninstallAccepted() = 0;
39 38
40 // We call this method to signal that the uninstallation should stop. 39 // We call this method to signal that the uninstallation should stop.
(...skipping 10 matching lines...) Expand all
51 static ExtensionUninstallDialog* Create(Profile* profile, 50 static ExtensionUninstallDialog* Create(Profile* profile,
52 Browser* browser, 51 Browser* browser,
53 Delegate* delegate); 52 Delegate* delegate);
54 53
55 virtual ~ExtensionUninstallDialog(); 54 virtual ~ExtensionUninstallDialog();
56 55
57 // This is called to verify whether the uninstallation should proceed. 56 // This is called to verify whether the uninstallation should proceed.
58 // Starts the process of showing a confirmation UI, which is split into two. 57 // Starts the process of showing a confirmation UI, which is split into two.
59 // 1) Set off a 'load icon' task. 58 // 1) Set off a 'load icon' task.
60 // 2) Handle the load icon response and show the UI (OnImageLoaded). 59 // 2) Handle the load icon response and show the UI (OnImageLoaded).
61 void ConfirmUninstall(const extensions::Extension* extension); 60 void ConfirmUninstall(const Extension* extension);
62 61
63 // This shows the same dialog as above, except it also shows which extension 62 // This shows the same dialog as above, except it also shows which extension
64 // triggered the dialog by calling chrome.management.uninstall API. 63 // triggered the dialog by calling chrome.management.uninstall API.
65 void ConfirmProgrammaticUninstall( 64 void ConfirmProgrammaticUninstall(const Extension* extension,
66 const extensions::Extension* extension, 65 const Extension* triggering_extension);
67 const extensions::Extension* triggering_extension);
68 66
69 std::string GetHeadingText(); 67 std::string GetHeadingText();
70 68
71 protected: 69 protected:
72 // Constructor used by the derived classes. 70 // Constructor used by the derived classes.
73 ExtensionUninstallDialog(Profile* profile, 71 ExtensionUninstallDialog(Profile* profile,
74 Browser* browser, 72 Browser* browser,
75 Delegate* delegate); 73 Delegate* delegate);
76 74
77 Profile* const profile_; 75 Profile* const profile_;
78 76
79 Browser* browser_; 77 Browser* browser_;
80 78
81 // The delegate we will call Accepted/Canceled on after confirmation dialog. 79 // The delegate we will call Accepted/Canceled on after confirmation dialog.
82 Delegate* delegate_; 80 Delegate* delegate_;
83 81
84 // The extension we are showing the dialog for. 82 // The extension we are showing the dialog for.
85 const extensions::Extension* extension_; 83 const Extension* extension_;
86 84
87 // The extension triggering the dialog if the dialog was shown by 85 // The extension triggering the dialog if the dialog was shown by
88 // chrome.management.uninstall. 86 // chrome.management.uninstall.
89 const extensions::Extension* triggering_extension_; 87 const Extension* triggering_extension_;
90 88
91 // The extensions icon. 89 // The extensions icon.
92 gfx::ImageSkia icon_; 90 gfx::ImageSkia icon_;
93 91
94 private: 92 private:
95 // Sets the icon that will be used in the dialog. If |icon| contains an empty 93 // Sets the icon that will be used in the dialog. If |icon| contains an empty
96 // image, then we use a default icon instead. 94 // image, then we use a default icon instead.
97 void SetIcon(const gfx::Image& image); 95 void SetIcon(const gfx::Image& image);
98 96
99 void OnImageLoaded(const std::string& extension_id, const gfx::Image& image); 97 void OnImageLoaded(const std::string& extension_id, const gfx::Image& image);
(...skipping 16 matching lines...) Expand all
116 }; 114 };
117 State state_; 115 State state_;
118 116
119 base::MessageLoop* ui_loop_; 117 base::MessageLoop* ui_loop_;
120 118
121 content::NotificationRegistrar registrar_; 119 content::NotificationRegistrar registrar_;
122 120
123 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialog); 121 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialog);
124 }; 122 };
125 123
124 } // namespace extensions
125
126 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_DIALOG_H_ 126 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_DIALOG_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_disabled_ui.cc ('k') | chrome/browser/extensions/extension_uninstall_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698