OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_GENERIC_DIALOG_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_GENERIC_DIALOG_H_ | |
7 #pragma once | |
8 | |
9 #include "base/basictypes.h" | |
10 #include "base/compiler_specific.h" | |
11 #include "chrome/browser/extensions/image_loading_tracker.h" | |
12 #include "third_party/skia/include/core/SkBitmap.h" | |
13 | |
14 class MessageLoop; | |
15 class Profile; | |
16 | |
17 class ExtensionGenericDialog : public ImageLoadingTracker::Observer { | |
18 public: | |
19 class Delegate { | |
20 public: | |
21 // We call this method to signal that the uninstallation should continue. | |
22 virtual void ExtensionDialogAccepted() = 0; | |
23 | |
24 // We call this method to signal that the uninstallation should stop. | |
25 virtual void ExtensionDialogCanceled() = 0; | |
26 | |
27 protected: | |
28 virtual ~Delegate() {} | |
29 }; | |
30 | |
31 explicit ExtensionGenericDialog(Profile* profile); | |
32 virtual ~ExtensionGenericDialog(); | |
33 | |
34 // This is called by the extensions management page to verify whether the | |
35 // uninstallation should proceed. | |
36 // Starts the process of showing a confirmation UI, which is split into two. | |
37 // 1) Set off a 'load icon' task. | |
38 // 2) Handle the load icon response and show the UI (OnImageLoaded). | |
39 void ConfirmUninstall(Delegate* delegate, const Extension* extension); | |
40 | |
41 private: | |
42 // Creates an appropriate ExtensionGenericDialog for the platform. | |
43 static void Show(Profile* profile, | |
Aaron Boodman
2011/03/24 19:22:03
Currently this class is called ExtensionGenericDia
tfarina
2011/03/24 21:39:47
I think at this moment makes more sense to call it
| |
44 Delegate* delegate, | |
45 const Extension* extension, | |
46 SkBitmap* icon); | |
47 | |
48 // Sets the icon that will be used in any UI. If |icon| is NULL, or contains | |
49 // an empty bitmap, then a default icon will be used instead. | |
50 void SetIcon(SkBitmap* icon); | |
51 | |
52 // ImageLoadingTracker::Observer: | |
53 virtual void OnImageLoaded(SkBitmap* image, | |
54 const ExtensionResource& resource, | |
55 int index) OVERRIDE; | |
56 | |
57 Profile* profile_; | |
58 MessageLoop* ui_loop_; | |
59 | |
60 // The delegate we will call Accepted/Canceled on after confirmation UI. | |
61 Delegate* delegate_; | |
62 | |
63 // The extension we are showing the UI for. | |
64 const Extension* extension_; | |
65 | |
66 // Keeps track of extension images being loaded on the File thread for the | |
67 // purpose of showing the install UI. | |
68 ImageLoadingTracker tracker_; | |
69 | |
70 // The extensions icon. | |
71 SkBitmap icon_; | |
72 | |
73 DISALLOW_COPY_AND_ASSIGN(ExtensionGenericDialog); | |
74 }; | |
75 | |
76 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GENERIC_DIALOG_H_ | |
OLD | NEW |