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 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 5 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // Called when the ExtensionUninstallDialogDelegate has been destroyed to make | 42 // Called when the ExtensionUninstallDialogDelegate has been destroyed to make |
43 // sure we invalidate pointers. | 43 // sure we invalidate pointers. |
44 void DialogDelegateDestroyed() { view_ = NULL; } | 44 void DialogDelegateDestroyed() { view_ = NULL; } |
45 | 45 |
46 // Forwards the accept and cancels to the delegate. | 46 // Forwards the accept and cancels to the delegate. |
47 void ExtensionUninstallAccepted(); | 47 void ExtensionUninstallAccepted(); |
48 void ExtensionUninstallCanceled(); | 48 void ExtensionUninstallCanceled(); |
49 | 49 |
50 private: | 50 private: |
51 virtual void Show() OVERRIDE; | 51 virtual void Show() override; |
52 | 52 |
53 ExtensionUninstallDialogDelegateView* view_; | 53 ExtensionUninstallDialogDelegateView* view_; |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialogViews); | 55 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialogViews); |
56 }; | 56 }; |
57 | 57 |
58 // The dialog's view, owned by the views framework. | 58 // The dialog's view, owned by the views framework. |
59 class ExtensionUninstallDialogDelegateView : public views::DialogDelegateView { | 59 class ExtensionUninstallDialogDelegateView : public views::DialogDelegateView { |
60 public: | 60 public: |
61 ExtensionUninstallDialogDelegateView( | 61 ExtensionUninstallDialogDelegateView( |
62 ExtensionUninstallDialogViews* dialog_view, | 62 ExtensionUninstallDialogViews* dialog_view, |
63 const extensions::Extension* extension, | 63 const extensions::Extension* extension, |
64 const extensions::Extension* triggering_extension, | 64 const extensions::Extension* triggering_extension, |
65 gfx::ImageSkia* image); | 65 gfx::ImageSkia* image); |
66 virtual ~ExtensionUninstallDialogDelegateView(); | 66 virtual ~ExtensionUninstallDialogDelegateView(); |
67 | 67 |
68 // Called when the ExtensionUninstallDialog has been destroyed to make sure | 68 // Called when the ExtensionUninstallDialog has been destroyed to make sure |
69 // we invalidate pointers. | 69 // we invalidate pointers. |
70 void DialogDestroyed() { dialog_ = NULL; } | 70 void DialogDestroyed() { dialog_ = NULL; } |
71 | 71 |
72 private: | 72 private: |
73 // views::DialogDelegate: | 73 // views::DialogDelegate: |
74 virtual base::string16 GetDialogButtonLabel( | 74 virtual base::string16 GetDialogButtonLabel( |
75 ui::DialogButton button) const OVERRIDE; | 75 ui::DialogButton button) const override; |
76 virtual int GetDefaultDialogButton() const OVERRIDE { | 76 virtual int GetDefaultDialogButton() const override { |
77 // Default to accept when triggered via chrome://extensions page. | 77 // Default to accept when triggered via chrome://extensions page. |
78 return triggered_by_extension_ ? | 78 return triggered_by_extension_ ? |
79 ui::DIALOG_BUTTON_CANCEL : ui::DIALOG_BUTTON_OK; | 79 ui::DIALOG_BUTTON_CANCEL : ui::DIALOG_BUTTON_OK; |
80 } | 80 } |
81 virtual bool Accept() OVERRIDE; | 81 virtual bool Accept() override; |
82 virtual bool Cancel() OVERRIDE; | 82 virtual bool Cancel() override; |
83 | 83 |
84 // views::WidgetDelegate: | 84 // views::WidgetDelegate: |
85 virtual ui::ModalType GetModalType() const OVERRIDE { | 85 virtual ui::ModalType GetModalType() const override { |
86 return ui::MODAL_TYPE_WINDOW; | 86 return ui::MODAL_TYPE_WINDOW; |
87 } | 87 } |
88 virtual base::string16 GetWindowTitle() const OVERRIDE; | 88 virtual base::string16 GetWindowTitle() const override; |
89 | 89 |
90 // views::View: | 90 // views::View: |
91 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 91 virtual gfx::Size GetPreferredSize() const override; |
92 | 92 |
93 virtual void Layout() OVERRIDE; | 93 virtual void Layout() override; |
94 | 94 |
95 ExtensionUninstallDialogViews* dialog_; | 95 ExtensionUninstallDialogViews* dialog_; |
96 | 96 |
97 views::ImageView* icon_; | 97 views::ImageView* icon_; |
98 views::Label* heading_; | 98 views::Label* heading_; |
99 bool triggered_by_extension_; | 99 bool triggered_by_extension_; |
100 | 100 |
101 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialogDelegateView); | 101 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialogDelegateView); |
102 }; | 102 }; |
103 | 103 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 } // namespace | 235 } // namespace |
236 | 236 |
237 // static | 237 // static |
238 extensions::ExtensionUninstallDialog* | 238 extensions::ExtensionUninstallDialog* |
239 extensions::ExtensionUninstallDialog::Create(Profile* profile, | 239 extensions::ExtensionUninstallDialog::Create(Profile* profile, |
240 gfx::NativeWindow parent, | 240 gfx::NativeWindow parent, |
241 Delegate* delegate) { | 241 Delegate* delegate) { |
242 return new ExtensionUninstallDialogViews(profile, parent, delegate); | 242 return new ExtensionUninstallDialogViews(profile, parent, delegate); |
243 } | 243 } |
OLD | NEW |