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

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

Issue 382133003: Refactored ExtensionUninstallDialog to take a NativeWindow instead of a Browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved Browser and GetParent() logic into constructor Created 6 years, 5 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) 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
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 standalone dialog. If |parent| is not NULL, makes the dialog modal to
55 // this parent window.
not at google - send to devlin 2014/07/23 01:49:21 comment still not clear. this method is called "Cr
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. If |browser| is set, |parent| is
77 // not needed; the native window of |browser| is used instead.
sashab 2014/07/22 00:30:43 If this is too complicated, we can move the GetPar
not at google - send to devlin 2014/07/23 01:49:21 I think it's too complicated, but only because you
71 ExtensionUninstallDialog(Profile* profile, 78 ExtensionUninstallDialog(Profile* profile,
72 Browser* browser, 79 Browser* browser,
80 gfx::NativeWindow parent,
73 Delegate* delegate); 81 Delegate* delegate);
74 82
75 Profile* const profile_; 83 Profile* const profile_;
76 84
77 Browser* browser_; 85 Browser* browser_;
not at google - send to devlin 2014/07/23 01:49:21 I don't actually see |browser_| being used anywher
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698