| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_view.h" | 5 #include "chrome/browser/ui/views/extensions/extension_installed_bubble_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 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/browser_action_view.h" | 27 #include "chrome/browser/ui/views/toolbar/browser_action_view.h" |
| 28 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 28 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 29 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 29 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 30 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h" | 30 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h" |
| 31 #include "chrome/common/extensions/sync_helper.h" | 31 #include "chrome/common/extensions/sync_helper.h" |
| 32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 33 #include "chrome/grit/chromium_strings.h" | 33 #include "chrome/grit/chromium_strings.h" |
| 34 #include "chrome/grit/generated_resources.h" | 34 #include "chrome/grit/generated_resources.h" |
| 35 #include "extensions/common/extension.h" | 35 #include "extensions/common/extension.h" |
| 36 #include "extensions/common/feature_switch.h" |
| 36 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
| 37 #include "ui/base/resource/resource_bundle.h" | 38 #include "ui/base/resource/resource_bundle.h" |
| 38 #include "ui/gfx/render_text.h" | 39 #include "ui/gfx/render_text.h" |
| 39 #include "ui/gfx/text_elider.h" | 40 #include "ui/gfx/text_elider.h" |
| 40 #include "ui/resources/grit/ui_resources.h" | 41 #include "ui/resources/grit/ui_resources.h" |
| 41 #include "ui/views/controls/button/image_button.h" | 42 #include "ui/views/controls/button/image_button.h" |
| 42 #include "ui/views/controls/image_view.h" | 43 #include "ui/views/controls/image_view.h" |
| 43 #include "ui/views/controls/label.h" | 44 #include "ui/views/controls/label.h" |
| 44 #include "ui/views/controls/link.h" | 45 #include "ui/views/controls/link.h" |
| 45 #include "ui/views/controls/link_listener.h" | 46 #include "ui/views/controls/link_listener.h" |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 : bubble_(this, extension, browser, icon) { | 523 : bubble_(this, extension, browser, icon) { |
| 523 } | 524 } |
| 524 | 525 |
| 525 ExtensionInstalledBubbleView::~ExtensionInstalledBubbleView() {} | 526 ExtensionInstalledBubbleView::~ExtensionInstalledBubbleView() {} |
| 526 | 527 |
| 527 bool ExtensionInstalledBubbleView::MaybeShowNow() { | 528 bool ExtensionInstalledBubbleView::MaybeShowNow() { |
| 528 BrowserView* browser_view = | 529 BrowserView* browser_view = |
| 529 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); | 530 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); |
| 530 | 531 |
| 531 views::View* reference_view = NULL; | 532 views::View* reference_view = NULL; |
| 532 if (bubble_.type() == bubble_.BROWSER_ACTION) { | 533 if (bubble_.type() == bubble_.BROWSER_ACTION || |
| 534 extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) { |
| 533 BrowserActionsContainer* container = | 535 BrowserActionsContainer* container = |
| 534 browser_view->GetToolbarView()->browser_actions(); | 536 browser_view->GetToolbarView()->browser_actions(); |
| 535 if (container->animating()) | 537 if (container->animating()) |
| 536 return false; | 538 return false; |
| 537 | 539 |
| 538 reference_view = container->GetViewForExtension(bubble_.extension()); | 540 reference_view = container->GetViewForExtension(bubble_.extension()); |
| 539 // If the view is not visible then it is in the chevron, so point the | 541 // If the view is not visible then it is in the chevron, so point the |
| 540 // install bubble to the chevron instead. If this is an incognito window, | 542 // install bubble to the chevron instead. If this is an incognito window, |
| 541 // both could be invisible. | 543 // both could be invisible. |
| 542 if (!reference_view || !reference_view->visible()) { | 544 if (!reference_view || !reference_view->visible()) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 const LocationBarView* location_bar_view = | 590 const LocationBarView* location_bar_view = |
| 589 BrowserView::GetBrowserViewForBrowser(bubble_.browser())-> | 591 BrowserView::GetBrowserViewForBrowser(bubble_.browser())-> |
| 590 GetLocationBarView(); | 592 GetLocationBarView(); |
| 591 return gfx::Rect(location_bar_view->GetOmniboxViewOrigin(), | 593 return gfx::Rect(location_bar_view->GetOmniboxViewOrigin(), |
| 592 gfx::Size(0, location_bar_view->omnibox_view()->height())); | 594 gfx::Size(0, location_bar_view->omnibox_view()->height())); |
| 593 } | 595 } |
| 594 return views::BubbleDelegateView::GetAnchorRect(); | 596 return views::BubbleDelegateView::GetAnchorRect(); |
| 595 } | 597 } |
| 596 | 598 |
| 597 void ExtensionInstalledBubbleView::WindowClosing() { | 599 void ExtensionInstalledBubbleView::WindowClosing() { |
| 598 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION) { | 600 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION && |
| 601 !extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) { |
| 599 BrowserView* browser_view = | 602 BrowserView* browser_view = |
| 600 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); | 603 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); |
| 601 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 604 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
| 602 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> | 605 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> |
| 603 GetPageAction(*bubble_.extension()), | 606 GetPageAction(*bubble_.extension()), |
| 604 false); // preview_enabled | 607 false); // preview_enabled |
| 605 } | 608 } |
| 606 } | 609 } |
| OLD | NEW |