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

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

Issue 7920023: Fix crashes related to the extension uninstall dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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_UI_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_DIALOG_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_UI_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/extensions/image_loading_tracker.h" 12 #include "chrome/browser/extensions/image_loading_tracker.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
13 14
15 class ExtensionUninstallDialog;
14 class MessageLoop; 16 class MessageLoop;
15 class Profile; 17 class Profile;
16 18
17 class ExtensionUninstallDialog : public ImageLoadingTracker::Observer { 19 class ExtensionUninstallUI : public ImageLoadingTracker::Observer {
18 public: 20 public:
19 class Delegate { 21 class Delegate {
20 public: 22 public:
21 // We call this method to signal that the uninstallation should continue. 23 // We call this method to signal that the uninstallation should continue.
22 virtual void ExtensionDialogAccepted() = 0; 24 virtual void ExtensionUninstallAccepted() = 0;
23 25
24 // We call this method to signal that the uninstallation should stop. 26 // We call this method to signal that the uninstallation should stop.
25 virtual void ExtensionDialogCanceled() = 0; 27 virtual void ExtensionUninstallCanceled() = 0;
26 28
27 protected: 29 protected:
28 virtual ~Delegate() {} 30 virtual ~Delegate() {}
29 }; 31 };
30 32
31 explicit ExtensionUninstallDialog(Profile* profile); 33 explicit ExtensionUninstallUI(Profile* profile);
32 virtual ~ExtensionUninstallDialog(); 34 virtual ~ExtensionUninstallUI();
33 35
34 // This is called by the extensions management page to verify whether the 36 // This is called by the extensions management page to verify whether the
35 // uninstallation should proceed. 37 // uninstallation should proceed.
36 // Starts the process of showing a confirmation UI, which is split into two. 38 // Starts the process of showing a confirmation UI, which is split into two.
37 // 1) Set off a 'load icon' task. 39 // 1) Set off a 'load icon' task.
38 // 2) Handle the load icon response and show the UI (OnImageLoaded). 40 // 2) Handle the load icon response and show the UI (OnImageLoaded).
39 void ConfirmUninstall(Delegate* delegate, const Extension* extension); 41 void ConfirmUninstall(Delegate* delegate, const Extension* extension);
40 42
41 private: 43 private:
42 // Creates an appropriate ExtensionUninstallDialog for the platform. 44 // Creates an appropriate ExtensionUninstallDialog for the platform.
43 static void Show(Profile* profile, 45 void ShowDialog();
Mihai Parparita -not on Chrome 2011/09/20 23:54:47 Can you add a comment "The implementations of this
jstritar 2011/09/22 16:47:13 Done.
44 Delegate* delegate,
45 const Extension* extension,
46 SkBitmap* icon);
47 46
48 // Sets the icon that will be used in any UI. If |icon| is NULL, or contains 47 // 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. 48 // an empty bitmap, then a default icon will be used instead.
50 void SetIcon(SkBitmap* icon); 49 void SetIcon(SkBitmap* icon);
51 50
52 // ImageLoadingTracker::Observer: 51 // ImageLoadingTracker::Observer:
53 virtual void OnImageLoaded(SkBitmap* image, 52 virtual void OnImageLoaded(SkBitmap* image,
54 const ExtensionResource& resource, 53 const ExtensionResource& resource,
55 int index) OVERRIDE; 54 int index) OVERRIDE;
56 55
57 Profile* profile_; 56 Profile* profile_;
58 MessageLoop* ui_loop_; 57 MessageLoop* ui_loop_;
59 58
59 scoped_ptr<ExtensionUninstallDialog> uninstall_dialog_;
60
60 // The delegate we will call Accepted/Canceled on after confirmation UI. 61 // The delegate we will call Accepted/Canceled on after confirmation UI.
61 Delegate* delegate_; 62 Delegate* delegate_;
62 63
63 // The extension we are showing the UI for. 64 // The extension we are showing the UI for.
64 const Extension* extension_; 65 const Extension* extension_;
65 66
66 // Keeps track of extension images being loaded on the File thread for the 67 // Keeps track of extension images being loaded on the File thread for the
67 // purpose of showing the install UI. 68 // purpose of showing the install UI.
68 ImageLoadingTracker tracker_; 69 ImageLoadingTracker tracker_;
69 70
70 // The extensions icon. 71 // The extensions icon.
71 SkBitmap icon_; 72 SkBitmap icon_;
72 73
73 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialog); 74 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallUI);
74 }; 75 };
75 76
76 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_DIALOG_H_ 77 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698