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_API_MANAGEMENT_MANAGEMENT_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | 9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
10 #include "chrome/browser/extensions/event_router.h" | 10 #include "chrome/browser/extensions/event_router.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 public: | 124 public: |
125 DECLARE_EXTENSION_FUNCTION_NAME("management.uninstall"); | 125 DECLARE_EXTENSION_FUNCTION_NAME("management.uninstall"); |
126 | 126 |
127 ManagementUninstallFunction(); | 127 ManagementUninstallFunction(); |
128 static void SetAutoConfirmForTest(bool should_proceed); | 128 static void SetAutoConfirmForTest(bool should_proceed); |
129 | 129 |
130 // ExtensionUninstallDialog::Delegate implementation. | 130 // ExtensionUninstallDialog::Delegate implementation. |
131 virtual void ExtensionUninstallAccepted() OVERRIDE; | 131 virtual void ExtensionUninstallAccepted() OVERRIDE; |
132 virtual void ExtensionUninstallCanceled() OVERRIDE; | 132 virtual void ExtensionUninstallCanceled() OVERRIDE; |
133 | 133 |
134 private: | 134 protected: |
135 virtual ~ManagementUninstallFunction(); | 135 virtual ~ManagementUninstallFunction(); |
136 | 136 |
137 bool DoUninstall(bool show_confirm_dialog); | |
138 void set_extension_id(const std::string& extension_id); | |
139 | |
140 private: | |
137 virtual bool RunImpl() OVERRIDE; | 141 virtual bool RunImpl() OVERRIDE; |
138 | 142 |
139 // If should_uninstall is true, this method does the actual uninstall. | 143 // If should_uninstall is true, this method does the actual uninstall. |
140 // If |show_uninstall_dialog|, then this function will be called by one of the | 144 // If |show_uninstall_dialog|, then this function will be called by one of the |
141 // Accepted/Canceled callbacks. Otherwise, it's called directly from RunImpl. | 145 // Accepted/Canceled callbacks. Otherwise, it's called directly from RunImpl. |
142 void Finish(bool should_uninstall); | 146 void Finish(bool should_uninstall); |
143 | 147 |
144 std::string extension_id_; | 148 std::string extension_id_; |
145 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; | 149 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; |
146 }; | 150 }; |
147 | 151 |
152 class ManagementUninstallSelfFunction : public ManagementUninstallFunction { | |
koz (OOO until 15th September)
2013/01/29 05:20:26
It's not common for functions to subclass each oth
calamity
2013/01/29 06:06:16
Done.
| |
153 public: | |
154 DECLARE_EXTENSION_FUNCTION_NAME("management.uninstallSelf"); | |
155 | |
156 ManagementUninstallSelfFunction(); | |
157 | |
158 private: | |
159 virtual ~ManagementUninstallSelfFunction(); | |
160 | |
161 virtual bool RunImpl() OVERRIDE; | |
162 }; | |
163 | |
148 class ManagementEventRouter : public content::NotificationObserver { | 164 class ManagementEventRouter : public content::NotificationObserver { |
149 public: | 165 public: |
150 explicit ManagementEventRouter(Profile* profile); | 166 explicit ManagementEventRouter(Profile* profile); |
151 virtual ~ManagementEventRouter(); | 167 virtual ~ManagementEventRouter(); |
152 | 168 |
153 private: | 169 private: |
154 // content::NotificationObserver implementation. | 170 // content::NotificationObserver implementation. |
155 virtual void Observe(int type, | 171 virtual void Observe(int type, |
156 const content::NotificationSource& source, | 172 const content::NotificationSource& source, |
157 const content::NotificationDetails& details) OVERRIDE; | 173 const content::NotificationDetails& details) OVERRIDE; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 | 208 |
193 // Created lazily upon OnListenerAdded. | 209 // Created lazily upon OnListenerAdded. |
194 scoped_ptr<ManagementEventRouter> management_event_router_; | 210 scoped_ptr<ManagementEventRouter> management_event_router_; |
195 | 211 |
196 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); | 212 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); |
197 }; | 213 }; |
198 | 214 |
199 } // namespace extensions | 215 } // namespace extensions |
200 | 216 |
201 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ | 217 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ |
OLD | NEW |