OLD | NEW |
---|---|
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 #include "ui/gfx/native_widget_types.h" | |
15 | 16 |
16 class Browser; | 17 class Browser; |
17 class Profile; | 18 class Profile; |
18 | 19 |
19 namespace base { | 20 namespace base { |
20 class MessageLoop; | 21 class MessageLoop; |
21 } | 22 } |
22 | 23 |
23 namespace gfx { | 24 namespace gfx { |
24 class Image; | 25 class Image; |
(...skipping 11 matching lines...) Expand all Loading... | |
36 // We call this method to signal that the uninstallation should continue. | 37 // We call this method to signal that the uninstallation should continue. |
37 virtual void ExtensionUninstallAccepted() = 0; | 38 virtual void ExtensionUninstallAccepted() = 0; |
38 | 39 |
39 // We call this method to signal that the uninstallation should stop. | 40 // We call this method to signal that the uninstallation should stop. |
40 virtual void ExtensionUninstallCanceled() = 0; | 41 virtual void ExtensionUninstallCanceled() = 0; |
41 | 42 |
42 protected: | 43 protected: |
43 virtual ~Delegate() {} | 44 virtual ~Delegate() {} |
44 }; | 45 }; |
45 | 46 |
46 // Creates a platform specific implementation of ExtensionUninstallDialog. | 47 // Creates a platform specific implementation of ExtensionUninstallDialog. No |
47 // |profile| and |delegate| can never be NULL. | 48 // parameters can be NULL. |
48 // |browser| can be NULL only for Ash when this is used with the applist | |
49 // window. | |
50 static ExtensionUninstallDialog* Create(Profile* profile, | 49 static ExtensionUninstallDialog* Create(Profile* profile, |
51 Browser* browser, | 50 Browser* browser, |
52 Delegate* delegate); | 51 Delegate* delegate); |
53 | 52 |
53 // Creates a platform specific implementation of ExtensionUninstallDialog as | |
54 // a modal to the given parent window. If |parent| is NULL, creates a | |
not at google - send to devlin
2014/07/21 20:07:48
I find this comment a bit confusing, since you say
sashab
2014/07/22 00:30:43
Yeah... It's a tradeoff between making another met
| |
55 // standalone dialog. | |
56 static ExtensionUninstallDialog* CreateModal(Profile* profile, | |
57 gfx::NativeWindow parent, | |
58 Delegate* delegate); | |
59 | |
54 virtual ~ExtensionUninstallDialog(); | 60 virtual ~ExtensionUninstallDialog(); |
55 | 61 |
56 // This is called to verify whether the uninstallation should proceed. | 62 // This is called to verify whether the uninstallation should proceed. |
57 // Starts the process of showing a confirmation UI, which is split into two. | 63 // Starts the process of showing a confirmation UI, which is split into two. |
58 // 1) Set off a 'load icon' task. | 64 // 1) Set off a 'load icon' task. |
59 // 2) Handle the load icon response and show the UI (OnImageLoaded). | 65 // 2) Handle the load icon response and show the UI (OnImageLoaded). |
60 void ConfirmUninstall(const Extension* extension); | 66 void ConfirmUninstall(const Extension* extension); |
61 | 67 |
62 // This shows the same dialog as above, except it also shows which extension | 68 // This shows the same dialog as above, except it also shows which extension |
63 // triggered the dialog by calling chrome.management.uninstall API. | 69 // triggered the dialog by calling chrome.management.uninstall API. |
64 void ConfirmProgrammaticUninstall(const Extension* extension, | 70 void ConfirmProgrammaticUninstall(const Extension* extension, |
65 const Extension* triggering_extension); | 71 const Extension* triggering_extension); |
66 | 72 |
67 std::string GetHeadingText(); | 73 std::string GetHeadingText(); |
68 | 74 |
69 protected: | 75 protected: |
70 // Constructor used by the derived classes. | 76 // Constructor used by the derived classes. |
71 ExtensionUninstallDialog(Profile* profile, | 77 ExtensionUninstallDialog(Profile* profile, |
72 Browser* browser, | 78 gfx::NativeWindow parent, |
73 Delegate* delegate); | 79 Delegate* delegate); |
74 | 80 |
81 // Registers this class as an observer for when the browser closes. | |
82 virtual void RegisterObserver(Browser* browser); | |
not at google - send to devlin
2014/07/21 20:07:48
I prefer the Browser-in-constructor approach to ne
sashab
2014/07/22 00:30:43
Agreed. In that case, I also moved the GetParent()
| |
83 | |
75 Profile* const profile_; | 84 Profile* const profile_; |
76 | 85 |
77 Browser* browser_; | 86 gfx::NativeWindow parent_; |
78 | 87 |
79 // The delegate we will call Accepted/Canceled on after confirmation dialog. | 88 // The delegate we will call Accepted/Canceled on after confirmation dialog. |
80 Delegate* delegate_; | 89 Delegate* delegate_; |
81 | 90 |
82 // The extension we are showing the dialog for. | 91 // The extension we are showing the dialog for. |
83 const Extension* extension_; | 92 const Extension* extension_; |
84 | 93 |
85 // The extension triggering the dialog if the dialog was shown by | 94 // The extension triggering the dialog if the dialog was shown by |
86 // chrome.management.uninstall. | 95 // chrome.management.uninstall. |
87 const Extension* triggering_extension_; | 96 const Extension* triggering_extension_; |
(...skipping 29 matching lines...) Expand all Loading... | |
117 base::MessageLoop* ui_loop_; | 126 base::MessageLoop* ui_loop_; |
118 | 127 |
119 content::NotificationRegistrar registrar_; | 128 content::NotificationRegistrar registrar_; |
120 | 129 |
121 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialog); | 130 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialog); |
122 }; | 131 }; |
123 | 132 |
124 } // namespace extensions | 133 } // namespace extensions |
125 | 134 |
126 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_DIALOG_H_ | 135 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_DIALOG_H_ |
OLD | NEW |