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

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

Issue 6721013: extensions: Refactor ExtensionInstallUI class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove the file Created 9 years, 9 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
(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 enum DialogType {
20 DIALOG_UNSET = -1,
21 DIALOG_UNINSTALL = 0,
22 DIALOG_RE_ENABLE,
23 DIALOG_NUM_TYPES
24 };
25
26 // A mapping from DialogType to message ID for various dialog content.
27 static const int kTitleIds[DIALOG_NUM_TYPES];
28 static const int kHeadingIds[DIALOG_NUM_TYPES];
29 static const int kButtonIds[DIALOG_NUM_TYPES];
30
31 class Delegate {
32 public:
33 // We call this method after ConfirmUninstall()/ConfirmReenable to signal
34 // that the uninstallation should continue.
35 virtual void ExtensionDialogAccepted() = 0;
36
37 // We call this method after ConfirmUninstall()/ConfirmReenable to signal
38 // that the uninstallation should stop.
39 virtual void ExtensionDialogCanceled() = 0;
40
41 protected:
42 virtual ~Delegate() {}
43 };
44
45 explicit ExtensionGenericDialog(Profile* profile);
46 virtual ~ExtensionGenericDialog();
47
48 // Creates an appropriate ExtensionGenericDialog for the platform.
49 static void Show(Profile* profile,
Aaron Boodman 2011/03/23 21:06:54 I think this should be private.
50 Delegate* delegate,
51 const Extension* extension,
52 SkBitmap* icon,
53 DialogType dialog_type);
54
55 // This is called by the extensions management page to verify whether the
Aaron Boodman 2011/03/23 21:06:54 I think you should collapse these two into just Sh
56 // uninstallation should proceed. This is declared virtual for testing.
57 //
58 // We *MUST* eventually call either Accepted() or Canceled() on |delegate|.
59 void ConfirmUninstall(Delegate* delegate, const Extension* extension);
60
61 // This is called by the app handler launcher to verify whether the app
62 // should be re-enabled. This is declared virtual for testing.
63 //
64 // We *MUST* eventually call either Accepted() or Canceled() on |delegate|.
65 void ConfirmReenable(Delegate* delegate, const Extension* extension);
66
67 private:
68 // Starts the process of showing a confirmation UI, which is split into two.
69 // 1) Set off a 'load icon' task.
70 // 2) Handle the load icon response and show the UI (OnImageLoaded).
71 void ShowConfirmation(DialogType dialog_type);
72
73 // Sets the icon that will be used in any UI. If |icon| is NULL, or contains
74 // an empty bitmap, then a default icon will be used instead.
75 void SetIcon(SkBitmap* icon);
76
77 // ImageLoadingTracker::Observer:
78 virtual void OnImageLoaded(SkBitmap* image,
79 const ExtensionResource& resource,
80 int index) OVERRIDE;
81
82 Profile* profile_;
83 MessageLoop* ui_loop_;
84
85 // The delegate we will call Accepted/Canceled on after confirmation UI.
86 Delegate* delegate_;
87
88 // The extension we are showing the UI for.
89 const Extension* extension_;
90
91 // The type of dialog we are going to show.
92 DialogType dialog_type_;
93
94 // Keeps track of extension images being loaded on the File thread for the
95 // purpose of showing the install UI.
96 ImageLoadingTracker tracker_;
97
98 // The extensions icon.
99 SkBitmap icon_;
100
101 DISALLOW_COPY_AND_ASSIGN(ExtensionGenericDialog);
102 };
103
104 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GENERIC_DIALOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698