Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc

Issue 1971463002: Get rid of some lingering MD-specific raster assets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: devlin review Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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);
151 DCHECK(reference_view); 143 DCHECK(reference_view);
152 break; 144 break;
153 } 145 }
154 case ExtensionInstalledBubble::ANCHOR_OMNIBOX: { 146 case ExtensionInstalledBubble::ANCHOR_OMNIBOX: {
155 reference_view = browser_view->GetLocationBarView()->location_icon_view(); 147 reference_view = browser_view->GetLocationBarView()->location_icon_view();
156 break; 148 break;
157 } 149 }
158 case ExtensionInstalledBubble::ANCHOR_APP_MENU: 150 case ExtensionInstalledBubble::ANCHOR_APP_MENU:
159 // Will be caught below. 151 // Will be caught below.
160 break; 152 break;
161 } 153 }
162 154
163 // Default case. 155 // Default case.
164 if (!reference_view) 156 if (!reference_view)
msw 2016/05/12 19:01:34 nit/q: should this now also check if the view isn'
Evan Stade 2016/05/12 19:15:32 Done.
165 reference_view = browser_view->GetToolbarView()->app_menu_button(); 157 reference_view = browser_view->GetToolbarView()->app_menu_button();
166 SetAnchorView(reference_view); 158 SetAnchorView(reference_view);
167 } 159 }
168 160
169 void ExtensionInstalledBubbleView::CloseBubble() { 161 void ExtensionInstalledBubbleView::CloseBubble() {
170 if (controller_ && controller_->anchor_position() == 162 if (controller_ && controller_->anchor_position() ==
171 ExtensionInstalledBubble::ANCHOR_PAGE_ACTION) { 163 ExtensionInstalledBubble::ANCHOR_PAGE_ACTION) {
172 BrowserView* browser_view = 164 BrowserView* browser_view =
173 BrowserView::GetBrowserViewForBrowser(browser()); 165 BrowserView::GetBrowserViewForBrowser(browser());
174 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( 166 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction(
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698