| 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_action.h" | 10 #include "base/metrics/user_metrics_action.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 views::View* reference_view = nullptr; | 124 views::View* reference_view = nullptr; |
| 125 switch (controller_->anchor_position()) { | 125 switch (controller_->anchor_position()) { |
| 126 case ExtensionInstalledBubble::ANCHOR_BROWSER_ACTION: { | 126 case ExtensionInstalledBubble::ANCHOR_BROWSER_ACTION: { |
| 127 BrowserActionsContainer* container = | 127 BrowserActionsContainer* container = |
| 128 browser_view->GetToolbarView()->browser_actions(); | 128 browser_view->GetToolbarView()->browser_actions(); |
| 129 // Hitting this DCHECK means |ShouldShow| failed. | 129 // Hitting this DCHECK means |ShouldShow| failed. |
| 130 DCHECK(!container->animating()); | 130 DCHECK(!container->animating()); |
| 131 | 131 |
| 132 reference_view = container->GetViewForId(controller_->extension()->id()); | 132 reference_view = container->GetViewForId(controller_->extension()->id()); |
| 133 // If the view is not visible then it is in the chevron, so point the | |
| 134 // install bubble to the chevron instead. If this is an incognito window, | |
| 135 // both could be invisible. | |
| 136 if (!reference_view || !reference_view->visible()) { | |
| 137 reference_view = container->chevron(); | |
| 138 if (!reference_view || !reference_view->visible()) | |
| 139 reference_view = nullptr; // fall back to app menu below. | |
| 140 } | |
| 141 break; | 133 break; |
| 142 } | 134 } |
| 143 case ExtensionInstalledBubble::ANCHOR_PAGE_ACTION: { | 135 case ExtensionInstalledBubble::ANCHOR_PAGE_ACTION: { |
| 144 LocationBarView* location_bar_view = browser_view->GetLocationBarView(); | 136 LocationBarView* location_bar_view = browser_view->GetLocationBarView(); |
| 145 ExtensionAction* page_action = | 137 ExtensionAction* page_action = |
| 146 extensions::ExtensionActionManager::Get(browser()->profile()) | 138 extensions::ExtensionActionManager::Get(browser()->profile()) |
| 147 ->GetPageAction(*controller_->extension()); | 139 ->GetPageAction(*controller_->extension()); |
| 148 location_bar_view->SetPreviewEnabledPageAction(page_action, | 140 location_bar_view->SetPreviewEnabledPageAction(page_action, |
| 149 true); // preview_enabled | 141 true); // preview_enabled |
| 150 reference_view = location_bar_view->GetPageActionView(page_action); | 142 reference_view = location_bar_view->GetPageActionView(page_action); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 ->browser_actions(); | 352 ->browser_actions(); |
| 361 return !container->animating(); | 353 return !container->animating(); |
| 362 } | 354 } |
| 363 return true; | 355 return true; |
| 364 } | 356 } |
| 365 | 357 |
| 366 // Implemented here to create the platform specific instance of the BubbleUi. | 358 // Implemented here to create the platform specific instance of the BubbleUi. |
| 367 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { | 359 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { |
| 368 return base::WrapUnique(new ExtensionInstalledBubbleUi(this)); | 360 return base::WrapUnique(new ExtensionInstalledBubbleUi(this)); |
| 369 } | 361 } |
| OLD | NEW |