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 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/ui/singleton_tabs.h" | 21 #include "chrome/browser/ui/singleton_tabs.h" |
22 #include "chrome/browser/ui/views/browser_action_view.h" | 22 #include "chrome/browser/ui/views/browser_action_view.h" |
23 #include "chrome/browser/ui/views/browser_actions_container.h" | 23 #include "chrome/browser/ui/views/browser_actions_container.h" |
24 #include "chrome/browser/ui/views/frame/browser_view.h" | 24 #include "chrome/browser/ui/views/frame/browser_view.h" |
25 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 25 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
26 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 26 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
27 #include "chrome/browser/ui/views/toolbar_view.h" | 27 #include "chrome/browser/ui/views/toolbar_view.h" |
28 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 28 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
29 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 29 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
30 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
| 31 #include "chrome/common/extensions/api/extension_action/action_info.h" |
31 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h" | 32 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h" |
32 #include "chrome/common/extensions/extension.h" | 33 #include "chrome/common/extensions/extension.h" |
33 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
34 #include "content/public/browser/notification_details.h" | 35 #include "content/public/browser/notification_details.h" |
35 #include "content/public/browser/notification_source.h" | 36 #include "content/public/browser/notification_source.h" |
36 #include "grit/chromium_strings.h" | 37 #include "grit/chromium_strings.h" |
37 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
38 #include "grit/ui_resources.h" | 39 #include "grit/ui_resources.h" |
39 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
40 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 browser_(browser), | 537 browser_(browser), |
537 icon_(icon), | 538 icon_(icon), |
538 animation_wait_retries_(0) { | 539 animation_wait_retries_(0) { |
539 extensions::ExtensionActionManager* extension_action_manager = | 540 extensions::ExtensionActionManager* extension_action_manager = |
540 extensions::ExtensionActionManager::Get(browser_->profile()); | 541 extensions::ExtensionActionManager::Get(browser_->profile()); |
541 if (!extensions::OmniboxInfo::GetKeyword(extension).empty()) | 542 if (!extensions::OmniboxInfo::GetKeyword(extension).empty()) |
542 type_ = OMNIBOX_KEYWORD; | 543 type_ = OMNIBOX_KEYWORD; |
543 else if (extension_action_manager->GetBrowserAction(*extension_)) | 544 else if (extension_action_manager->GetBrowserAction(*extension_)) |
544 type_ = BROWSER_ACTION; | 545 type_ = BROWSER_ACTION; |
545 else if (extension_action_manager->GetPageAction(*extension) && | 546 else if (extension_action_manager->GetPageAction(*extension) && |
546 extensions::OmniboxInfo::IsVerboseInstallMessage(extension)) | 547 extensions::ActionInfo::IsVerboseInstallMessage(extension)) |
547 type_ = PAGE_ACTION; | 548 type_ = PAGE_ACTION; |
548 else | 549 else |
549 type_ = GENERIC; | 550 type_ = GENERIC; |
550 | 551 |
551 // |extension| has been initialized but not loaded at this point. We need | 552 // |extension| has been initialized but not loaded at this point. We need |
552 // to wait on showing the Bubble until not only the EXTENSION_LOADED gets | 553 // to wait on showing the Bubble until not only the EXTENSION_LOADED gets |
553 // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we | 554 // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we |
554 // be sure that a BrowserAction or PageAction has had views created which we | 555 // be sure that a BrowserAction or PageAction has had views created which we |
555 // can inspect for the purpose of previewing of pointing to them. | 556 // can inspect for the purpose of previewing of pointing to them. |
556 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 557 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 | 659 |
659 void ExtensionInstalledBubble::WindowClosing() { | 660 void ExtensionInstalledBubble::WindowClosing() { |
660 if (extension_ && type_ == PAGE_ACTION) { | 661 if (extension_ && type_ == PAGE_ACTION) { |
661 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 662 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
662 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 663 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
663 extensions::ExtensionActionManager::Get(browser_->profile())-> | 664 extensions::ExtensionActionManager::Get(browser_->profile())-> |
664 GetPageAction(*extension_), | 665 GetPageAction(*extension_), |
665 false); // preview_enabled | 666 false); // preview_enabled |
666 } | 667 } |
667 } | 668 } |
OLD | NEW |