OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/extension_installed_bubble_gtk.h" | 5 #include "chrome/browser/gtk/extension_installed_bubble_gtk.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 // |extension| has been initialized but not loaded at this point. We need | 69 // |extension| has been initialized but not loaded at this point. We need |
70 // to wait on showing the Bubble until not only the EXTENSION_LOADED gets | 70 // to wait on showing the Bubble until not only the EXTENSION_LOADED gets |
71 // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we | 71 // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we |
72 // be sure that a browser action or page action has had views created which we | 72 // be sure that a browser action or page action has had views created which we |
73 // can inspect for the purpose of pointing to them. | 73 // can inspect for the purpose of pointing to them. |
74 registrar_.Add(this, NotificationType::EXTENSION_LOADED, | 74 registrar_.Add(this, NotificationType::EXTENSION_LOADED, |
75 NotificationService::AllSources()); | 75 NotificationService::AllSources()); |
76 } | 76 } |
77 | 77 |
| 78 ExtensionInstalledBubbleGtk::~ExtensionInstalledBubbleGtk() {} |
| 79 |
78 void ExtensionInstalledBubbleGtk::Observe(NotificationType type, | 80 void ExtensionInstalledBubbleGtk::Observe(NotificationType type, |
79 const NotificationSource& source, | 81 const NotificationSource& source, |
80 const NotificationDetails& details) { | 82 const NotificationDetails& details) { |
81 if (type == NotificationType::EXTENSION_LOADED) { | 83 if (type == NotificationType::EXTENSION_LOADED) { |
82 Extension* extension = Details<Extension>(details).ptr(); | 84 Extension* extension = Details<Extension>(details).ptr(); |
83 if (extension == extension_) { | 85 if (extension == extension_) { |
84 // PostTask to ourself to allow all EXTENSION_LOADED Observers to run. | 86 // PostTask to ourself to allow all EXTENSION_LOADED Observers to run. |
85 MessageLoopForUI::current()->PostTask(FROM_HERE, NewRunnableMethod(this, | 87 MessageLoopForUI::current()->PostTask(FROM_HERE, NewRunnableMethod(this, |
86 &ExtensionInstalledBubbleGtk::ShowInternal)); | 88 &ExtensionInstalledBubbleGtk::ShowInternal)); |
87 } | 89 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // the window before we call Release() because close_button_ depends | 263 // the window before we call Release() because close_button_ depends |
262 // on all references being cleared before it is destroyed. | 264 // on all references being cleared before it is destroyed. |
263 MessageLoopForUI::current()->PostTask(FROM_HERE, NewRunnableMethod(this, | 265 MessageLoopForUI::current()->PostTask(FROM_HERE, NewRunnableMethod(this, |
264 &ExtensionInstalledBubbleGtk::Close)); | 266 &ExtensionInstalledBubbleGtk::Close)); |
265 } | 267 } |
266 | 268 |
267 void ExtensionInstalledBubbleGtk::Close() { | 269 void ExtensionInstalledBubbleGtk::Close() { |
268 Release(); // Balanced in ctor. | 270 Release(); // Balanced in ctor. |
269 info_bubble_ = NULL; | 271 info_bubble_ = NULL; |
270 } | 272 } |
OLD | NEW |