| 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/views/extensions/extension_installed_bubble.h" | 5 #include "chrome/browser/ui/views/extensions/extension_installed_bubble.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 new ExtensionInstalledBubble(extension, browser, icon); | 344 new ExtensionInstalledBubble(extension, browser, icon); |
| 345 } | 345 } |
| 346 | 346 |
| 347 ExtensionInstalledBubble::ExtensionInstalledBubble(const Extension* extension, | 347 ExtensionInstalledBubble::ExtensionInstalledBubble(const Extension* extension, |
| 348 Browser *browser, | 348 Browser *browser, |
| 349 const SkBitmap& icon) | 349 const SkBitmap& icon) |
| 350 : extension_(extension), | 350 : extension_(extension), |
| 351 browser_(browser), | 351 browser_(browser), |
| 352 icon_(icon), | 352 icon_(icon), |
| 353 animation_wait_retries_(0) { | 353 animation_wait_retries_(0) { |
| 354 if (extension->is_app()) { | 354 if (extension->is_app()) |
| 355 type_ = APP; | 355 type_ = APP; |
| 356 } else if (!extension_->omnibox_keyword().empty()) { | 356 else if (!extension_->omnibox_keyword().empty()) |
| 357 type_ = OMNIBOX_KEYWORD; | 357 type_ = OMNIBOX_KEYWORD; |
| 358 } else if (extension_->browser_action()) { | 358 else if (extension_->browser_action()) |
| 359 type_ = BROWSER_ACTION; | 359 type_ = BROWSER_ACTION; |
| 360 } else if (extension->page_action() && | 360 else if (extension->page_action() && extension->is_verbose_install_message()) |
| 361 !extension->page_action()->default_icon_path().empty()) { | |
| 362 type_ = PAGE_ACTION; | 361 type_ = PAGE_ACTION; |
| 363 } else { | 362 else |
| 364 type_ = GENERIC; | 363 type_ = GENERIC; |
| 365 } | |
| 366 | 364 |
| 367 // |extension| has been initialized but not loaded at this point. We need | 365 // |extension| has been initialized but not loaded at this point. We need |
| 368 // to wait on showing the Bubble until not only the EXTENSION_LOADED gets | 366 // to wait on showing the Bubble until not only the EXTENSION_LOADED gets |
| 369 // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we | 367 // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we |
| 370 // be sure that a BrowserAction or PageAction has had views created which we | 368 // be sure that a BrowserAction or PageAction has had views created which we |
| 371 // can inspect for the purpose of previewing of pointing to them. | 369 // can inspect for the purpose of previewing of pointing to them. |
| 372 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 370 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
| 373 content::Source<Profile>(browser->profile())); | 371 content::Source<Profile>(browser->profile())); |
| 374 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 372 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 375 content::Source<Profile>(browser->profile())); | 373 content::Source<Profile>(browser->profile())); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 } | 479 } |
| 482 | 480 |
| 483 void ExtensionInstalledBubble::WindowClosing() { | 481 void ExtensionInstalledBubble::WindowClosing() { |
| 484 if (extension_ && type_ == PAGE_ACTION) { | 482 if (extension_ && type_ == PAGE_ACTION) { |
| 485 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 483 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
| 486 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 484 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
| 487 extension_->page_action(), | 485 extension_->page_action(), |
| 488 false); // preview_enabled | 486 false); // preview_enabled |
| 489 } | 487 } |
| 490 } | 488 } |
| OLD | NEW |