| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/user_metrics.h" | 10 #include "base/metrics/user_metrics.h" |
| 11 #include "base/metrics/user_metrics_action.h" | 11 #include "base/metrics/user_metrics_action.h" |
| 12 #include "chrome/browser/extensions/extension_action_manager.h" | 12 #include "chrome/browser/extensions/extension_action_manager.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_dialogs.h" |
| 14 #include "chrome/browser/ui/chrome_pages.h" | 15 #include "chrome/browser/ui/chrome_pages.h" |
| 15 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" | 16 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" |
| 16 #include "chrome/browser/ui/singleton_tabs.h" | 17 #include "chrome/browser/ui/singleton_tabs.h" |
| 17 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" | 18 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" |
| 18 #include "chrome/browser/ui/views/frame/browser_view.h" | 19 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 19 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 20 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 20 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 21 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 21 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 22 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 22 #include "chrome/browser/ui/views/sync/bubble_sync_promo_view.h" | 23 #include "chrome/browser/ui/views/sync/bubble_sync_promo_view.h" |
| 23 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" | 24 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 ExtensionInstalledBubbleView::ExtensionInstalledBubbleView( | 107 ExtensionInstalledBubbleView::ExtensionInstalledBubbleView( |
| 107 ExtensionInstalledBubble* controller) | 108 ExtensionInstalledBubble* controller) |
| 108 : BubbleDialogDelegateView(nullptr, | 109 : BubbleDialogDelegateView(nullptr, |
| 109 controller->anchor_position() == | 110 controller->anchor_position() == |
| 110 ExtensionInstalledBubble::ANCHOR_OMNIBOX | 111 ExtensionInstalledBubble::ANCHOR_OMNIBOX |
| 111 ? views::BubbleBorder::TOP_LEFT | 112 ? views::BubbleBorder::TOP_LEFT |
| 112 : views::BubbleBorder::TOP_RIGHT), | 113 : views::BubbleBorder::TOP_RIGHT), |
| 113 controller_(controller), | 114 controller_(controller), |
| 114 manage_shortcut_(nullptr) {} | 115 manage_shortcut_(nullptr) { |
| 116 chrome::RecordDialogCreation(chrome::DialogIdentifier::EXTENSION_INSTALLED); |
| 117 } |
| 115 | 118 |
| 116 ExtensionInstalledBubbleView::~ExtensionInstalledBubbleView() {} | 119 ExtensionInstalledBubbleView::~ExtensionInstalledBubbleView() {} |
| 117 | 120 |
| 118 void ExtensionInstalledBubbleView::UpdateAnchorView() { | 121 void ExtensionInstalledBubbleView::UpdateAnchorView() { |
| 119 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); | 122 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); |
| 120 | 123 |
| 121 views::View* reference_view = nullptr; | 124 views::View* reference_view = nullptr; |
| 122 switch (controller_->anchor_position()) { | 125 switch (controller_->anchor_position()) { |
| 123 case ExtensionInstalledBubble::ANCHOR_ACTION: { | 126 case ExtensionInstalledBubble::ANCHOR_ACTION: { |
| 124 BrowserActionsContainer* container = | 127 BrowserActionsContainer* container = |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 ->browser_actions(); | 339 ->browser_actions(); |
| 337 return !container->animating(); | 340 return !container->animating(); |
| 338 } | 341 } |
| 339 return true; | 342 return true; |
| 340 } | 343 } |
| 341 | 344 |
| 342 // Implemented here to create the platform specific instance of the BubbleUi. | 345 // Implemented here to create the platform specific instance of the BubbleUi. |
| 343 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { | 346 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { |
| 344 return base::WrapUnique(new ExtensionInstalledBubbleUi(this)); | 347 return base::WrapUnique(new ExtensionInstalledBubbleUi(this)); |
| 345 } | 348 } |
| OLD | NEW |