| 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/ui/gtk/extensions/extension_installed_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 71 } |
| 72 | 72 |
| 73 ExtensionInstalledBubbleGtk::ExtensionInstalledBubbleGtk( | 73 ExtensionInstalledBubbleGtk::ExtensionInstalledBubbleGtk( |
| 74 const Extension* extension, Browser *browser, const SkBitmap& icon) | 74 const Extension* extension, Browser *browser, const SkBitmap& icon) |
| 75 : extension_(extension), | 75 : extension_(extension), |
| 76 browser_(browser), | 76 browser_(browser), |
| 77 icon_(icon), | 77 icon_(icon), |
| 78 animation_wait_retries_(kAnimationWaitRetries) { | 78 animation_wait_retries_(kAnimationWaitRetries) { |
| 79 AddRef(); // Balanced in Close(). | 79 AddRef(); // Balanced in Close(). |
| 80 | 80 |
| 81 if (!extension_->omnibox_keyword().empty()) { | 81 if (!extension_->omnibox_keyword().empty()) |
| 82 type_ = OMNIBOX_KEYWORD; | 82 type_ = OMNIBOX_KEYWORD; |
| 83 } else if (extension_->browser_action()) { | 83 else if (extension_->browser_action()) |
| 84 type_ = BROWSER_ACTION; | 84 type_ = BROWSER_ACTION; |
| 85 } else if (extension->page_action() && | 85 else if (extension->page_action() && extension->is_verbose_install_message()) |
| 86 !extension->page_action()->default_icon_path().empty()) { | |
| 87 type_ = PAGE_ACTION; | 86 type_ = PAGE_ACTION; |
| 88 } else { | 87 else |
| 89 type_ = GENERIC; | 88 type_ = GENERIC; |
| 90 } | |
| 91 | 89 |
| 92 // |extension| has been initialized but not loaded at this point. We need | 90 // |extension| has been initialized but not loaded at this point. We need |
| 93 // to wait on showing the Bubble until not only the EXTENSION_LOADED gets | 91 // to wait on showing the Bubble until not only the EXTENSION_LOADED gets |
| 94 // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we | 92 // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we |
| 95 // be sure that a browser action or page action has had views created which we | 93 // be sure that a browser action or page action has had views created which we |
| 96 // can inspect for the purpose of pointing to them. | 94 // can inspect for the purpose of pointing to them. |
| 97 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 95 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
| 98 content::Source<Profile>(browser->profile())); | 96 content::Source<Profile>(browser->profile())); |
| 99 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 97 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 100 content::Source<Profile>(browser->profile())); | 98 content::Source<Profile>(browser->profile())); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 // on all references being cleared before it is destroyed. | 367 // on all references being cleared before it is destroyed. |
| 370 MessageLoopForUI::current()->PostTask( | 368 MessageLoopForUI::current()->PostTask( |
| 371 FROM_HERE, | 369 FROM_HERE, |
| 372 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); | 370 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); |
| 373 } | 371 } |
| 374 | 372 |
| 375 void ExtensionInstalledBubbleGtk::Close() { | 373 void ExtensionInstalledBubbleGtk::Close() { |
| 376 Release(); // Balanced in ctor. | 374 Release(); // Balanced in ctor. |
| 377 bubble_ = NULL; | 375 bubble_ = NULL; |
| 378 } | 376 } |
| OLD | NEW |