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" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/extensions/api/commands/command_service.h" | 14 #include "chrome/browser/extensions/api/commands/command_service.h" |
15 #include "chrome/browser/extensions/extension_action.h" | 15 #include "chrome/browser/extensions/extension_action.h" |
16 #include "chrome/browser/extensions/extension_action_manager.h" | 16 #include "chrome/browser/extensions/extension_action_manager.h" |
17 #include "chrome/browser/extensions/extension_install_ui.h" | 17 #include "chrome/browser/extensions/extension_install_ui.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
20 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
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/frame/immersive_mode_controller.h" |
25 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 26 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
26 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 27 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
27 #include "chrome/browser/ui/views/toolbar_view.h" | 28 #include "chrome/browser/ui/views/toolbar_view.h" |
28 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 29 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
29 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
30 #include "chrome/common/extensions/api/extension_action/action_info.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/extensions/sync_helper.h" | 34 #include "chrome/common/extensions/sync_helper.h" |
34 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 // Default case. | 647 // Default case. |
647 if (reference_view == NULL) | 648 if (reference_view == NULL) |
648 reference_view = browser_view->GetToolbarView()->app_menu(); | 649 reference_view = browser_view->GetToolbarView()->app_menu(); |
649 set_anchor_view(reference_view); | 650 set_anchor_view(reference_view); |
650 | 651 |
651 set_arrow(type_ == OMNIBOX_KEYWORD ? views::BubbleBorder::TOP_LEFT : | 652 set_arrow(type_ == OMNIBOX_KEYWORD ? views::BubbleBorder::TOP_LEFT : |
652 views::BubbleBorder::TOP_RIGHT); | 653 views::BubbleBorder::TOP_RIGHT); |
653 SetLayoutManager(new views::FillLayout()); | 654 SetLayoutManager(new views::FillLayout()); |
654 AddChildView( | 655 AddChildView( |
655 new InstalledBubbleContent(browser_, extension_, type_, &icon_, this)); | 656 new InstalledBubbleContent(browser_, extension_, type_, &icon_, this)); |
| 657 |
| 658 // If we are in immersive fullscreen, reveal the top-of-window views |
| 659 // (omnibox, toolbar) so that the view the bubble is anchored to is visible. |
| 660 // We do not need to hold onto the lock because ImmersiveModeController will |
| 661 // keep the top-of-window views revealed as long as the popup is active. |
| 662 // TODO(pkotwicz): Move logic to ImmersiveModeController. |
| 663 scoped_ptr<ImmersiveRevealedLock> immersive_reveal_lock( |
| 664 browser_view->immersive_mode_controller()->GetRevealedLock( |
| 665 ImmersiveModeController::ANIMATE_REVEAL_NO)); |
656 views::BubbleDelegateView::CreateBubble(this); | 666 views::BubbleDelegateView::CreateBubble(this); |
657 | 667 |
658 // The bubble widget is now the parent and owner of |this| and takes care of | 668 // The bubble widget is now the parent and owner of |this| and takes care of |
659 // deletion when the bubble or browser go away. | 669 // deletion when the bubble or browser go away. |
660 registrar_.Remove(this, chrome::NOTIFICATION_BROWSER_CLOSING, | 670 registrar_.Remove(this, chrome::NOTIFICATION_BROWSER_CLOSING, |
661 content::Source<Browser>(browser_)); | 671 content::Source<Browser>(browser_)); |
662 | 672 |
663 StartFade(true); | 673 StartFade(true); |
664 } | 674 } |
665 | 675 |
(...skipping 11 matching lines...) Expand all Loading... |
677 | 687 |
678 void ExtensionInstalledBubble::WindowClosing() { | 688 void ExtensionInstalledBubble::WindowClosing() { |
679 if (extension_ && type_ == PAGE_ACTION) { | 689 if (extension_ && type_ == PAGE_ACTION) { |
680 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 690 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
681 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 691 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
682 extensions::ExtensionActionManager::Get(browser_->profile())-> | 692 extensions::ExtensionActionManager::Get(browser_->profile())-> |
683 GetPageAction(*extension_), | 693 GetPageAction(*extension_), |
684 false); // preview_enabled | 694 false); // preview_enabled |
685 } | 695 } |
686 } | 696 } |
OLD | NEW |