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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 browser_(browser), | 545 browser_(browser), |
545 icon_(icon), | 546 icon_(icon), |
546 animation_wait_retries_(0) { | 547 animation_wait_retries_(0) { |
547 extensions::ExtensionActionManager* extension_action_manager = | 548 extensions::ExtensionActionManager* extension_action_manager = |
548 extensions::ExtensionActionManager::Get(browser_->profile()); | 549 extensions::ExtensionActionManager::Get(browser_->profile()); |
549 if (!extensions::OmniboxInfo::GetKeyword(extension).empty()) | 550 if (!extensions::OmniboxInfo::GetKeyword(extension).empty()) |
550 type_ = OMNIBOX_KEYWORD; | 551 type_ = OMNIBOX_KEYWORD; |
551 else if (extension_action_manager->GetBrowserAction(*extension_)) | 552 else if (extension_action_manager->GetBrowserAction(*extension_)) |
552 type_ = BROWSER_ACTION; | 553 type_ = BROWSER_ACTION; |
553 else if (extension_action_manager->GetPageAction(*extension) && | 554 else if (extension_action_manager->GetPageAction(*extension) && |
554 extensions::OmniboxInfo::IsVerboseInstallMessage(extension)) | 555 extensions::ActionInfo::IsVerboseInstallMessage(extension)) |
555 type_ = PAGE_ACTION; | 556 type_ = PAGE_ACTION; |
556 else | 557 else |
557 type_ = GENERIC; | 558 type_ = GENERIC; |
558 | 559 |
559 // |extension| has been initialized but not loaded at this point. We need | 560 // |extension| has been initialized but not loaded at this point. We need |
560 // to wait on showing the Bubble until not only the EXTENSION_LOADED gets | 561 // to wait on showing the Bubble until not only the EXTENSION_LOADED gets |
561 // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we | 562 // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we |
562 // be sure that a BrowserAction or PageAction has had views created which we | 563 // be sure that a BrowserAction or PageAction has had views created which we |
563 // can inspect for the purpose of previewing of pointing to them. | 564 // can inspect for the purpose of previewing of pointing to them. |
564 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 565 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 | 667 |
667 void ExtensionInstalledBubble::WindowClosing() { | 668 void ExtensionInstalledBubble::WindowClosing() { |
668 if (extension_ && type_ == PAGE_ACTION) { | 669 if (extension_ && type_ == PAGE_ACTION) { |
669 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 670 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
670 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 671 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
671 extensions::ExtensionActionManager::Get(browser_->profile())-> | 672 extensions::ExtensionActionManager::Get(browser_->profile())-> |
672 GetPageAction(*extension_), | 673 GetPageAction(*extension_), |
673 false); // preview_enabled | 674 false); // preview_enabled |
674 } | 675 } |
675 } | 676 } |
OLD | NEW |