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/toolbar/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 animation_target_size_ = width(); | 299 animation_target_size_ = width(); |
300 resize_animation_->Reset(); | 300 resize_animation_->Reset(); |
301 } | 301 } |
302 | 302 |
303 int BrowserActionsContainer::GetChevronWidth() const { | 303 int BrowserActionsContainer::GetChevronWidth() const { |
304 return chevron_ ? | 304 return chevron_ ? |
305 chevron_->GetPreferredSize().width() + GetChevronSpacing() : 0; | 305 chevron_->GetPreferredSize().width() + GetChevronSpacing() : 0; |
306 } | 306 } |
307 | 307 |
308 void BrowserActionsContainer::ShowToolbarActionBubble( | 308 void BrowserActionsContainer::ShowToolbarActionBubble( |
309 scoped_ptr<ToolbarActionsBarBubbleDelegate> controller) { | 309 std::unique_ptr<ToolbarActionsBarBubbleDelegate> controller) { |
310 // The container shouldn't be asked to show a bubble if it's animating. | 310 // The container shouldn't be asked to show a bubble if it's animating. |
311 DCHECK(!animating()); | 311 DCHECK(!animating()); |
312 views::View* anchor_view = nullptr; | 312 views::View* anchor_view = nullptr; |
313 if (!controller->GetAnchorActionId().empty()) { | 313 if (!controller->GetAnchorActionId().empty()) { |
314 ToolbarActionView* action_view = | 314 ToolbarActionView* action_view = |
315 GetViewForId(controller->GetAnchorActionId()); | 315 GetViewForId(controller->GetAnchorActionId()); |
316 anchor_view = | 316 anchor_view = |
317 action_view->visible() ? action_view : GetOverflowReferenceView(); | 317 action_view->visible() ? action_view : GetOverflowReferenceView(); |
318 } else { | 318 } else { |
319 anchor_view = this; | 319 anchor_view = this; |
320 } | 320 } |
321 ToolbarActionsBarBubbleViews* bubble = | 321 ToolbarActionsBarBubbleViews* bubble = |
322 new ToolbarActionsBarBubbleViews(anchor_view, std::move(controller)); | 322 new ToolbarActionsBarBubbleViews(anchor_view, std::move(controller)); |
323 views::BubbleDelegateView::CreateBubble(bubble); | 323 views::BubbleDelegateView::CreateBubble(bubble); |
324 bubble->Show(); | 324 bubble->Show(); |
325 } | 325 } |
326 | 326 |
327 void BrowserActionsContainer::ShowExtensionMessageBubble( | 327 void BrowserActionsContainer::ShowExtensionMessageBubble( |
328 scoped_ptr<extensions::ExtensionMessageBubbleController> controller, | 328 std::unique_ptr<extensions::ExtensionMessageBubbleController> controller, |
329 ToolbarActionViewController* anchor_action) { | 329 ToolbarActionViewController* anchor_action) { |
330 // The container shouldn't be asked to show a bubble if it's animating. | 330 // The container shouldn't be asked to show a bubble if it's animating. |
331 DCHECK(!animating()); | 331 DCHECK(!animating()); |
332 | 332 |
333 views::View* reference_view = | 333 views::View* reference_view = |
334 anchor_action | 334 anchor_action |
335 ? static_cast<views::View*>(GetViewForId(anchor_action->GetId())) | 335 ? static_cast<views::View*>(GetViewForId(anchor_action->GetId())) |
336 : BrowserView::GetBrowserViewForBrowser(browser_) | 336 : BrowserView::GetBrowserViewForBrowser(browser_) |
337 ->toolbar() | 337 ->toolbar() |
338 ->app_menu_button(); | 338 ->app_menu_button(); |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 warning_highlight_painter_.reset( | 760 warning_highlight_painter_.reset( |
761 views::Painter::CreateImageGridPainter(kWarningImages)); | 761 views::Painter::CreateImageGridPainter(kWarningImages)); |
762 } | 762 } |
763 | 763 |
764 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { | 764 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { |
765 DCHECK(active_bubble_); | 765 DCHECK(active_bubble_); |
766 DCHECK_EQ(active_bubble_->GetWidget(), widget); | 766 DCHECK_EQ(active_bubble_->GetWidget(), widget); |
767 widget->RemoveObserver(this); | 767 widget->RemoveObserver(this); |
768 active_bubble_ = nullptr; | 768 active_bubble_ = nullptr; |
769 } | 769 } |
OLD | NEW |