| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_toolbar_icon_surfacing_bu
bble_views.h" | 5 #include "chrome/browser/ui/views/extensions/extension_toolbar_icon_surfacing_bu
bble_views.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" | 9 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" |
| 8 #include "chrome/grit/locale_settings.h" | 10 #include "chrome/grit/locale_settings.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/views/controls/button/label_button.h" | 12 #include "ui/views/controls/button/label_button.h" |
| 11 #include "ui/views/controls/label.h" | 13 #include "ui/views/controls/label.h" |
| 12 #include "ui/views/layout/grid_layout.h" | 14 #include "ui/views/layout/grid_layout.h" |
| 13 #include "ui/views/layout/layout_constants.h" | 15 #include "ui/views/layout/layout_constants.h" |
| 14 | 16 |
| 15 ExtensionToolbarIconSurfacingBubble::ExtensionToolbarIconSurfacingBubble( | 17 ExtensionToolbarIconSurfacingBubble::ExtensionToolbarIconSurfacingBubble( |
| 16 views::View* anchor_view, | 18 views::View* anchor_view, |
| 17 scoped_ptr<ToolbarActionsBarBubbleDelegate> delegate) | 19 scoped_ptr<ToolbarActionsBarBubbleDelegate> delegate) |
| 18 : views::BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), | 20 : views::BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), |
| 19 delegate_(delegate.Pass()), | 21 delegate_(std::move(delegate)), |
| 20 acknowledged_(false) { | 22 acknowledged_(false) {} |
| 21 } | |
| 22 | 23 |
| 23 ExtensionToolbarIconSurfacingBubble::~ExtensionToolbarIconSurfacingBubble() { | 24 ExtensionToolbarIconSurfacingBubble::~ExtensionToolbarIconSurfacingBubble() { |
| 24 } | 25 } |
| 25 | 26 |
| 26 void ExtensionToolbarIconSurfacingBubble::Show() { | 27 void ExtensionToolbarIconSurfacingBubble::Show() { |
| 27 delegate_->OnBubbleShown(); | 28 delegate_->OnBubbleShown(); |
| 28 GetWidget()->Show(); | 29 GetWidget()->Show(); |
| 29 } | 30 } |
| 30 | 31 |
| 31 void ExtensionToolbarIconSurfacingBubble::Init() { | 32 void ExtensionToolbarIconSurfacingBubble::Init() { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 88 } |
| 88 } | 89 } |
| 89 | 90 |
| 90 void ExtensionToolbarIconSurfacingBubble::ButtonPressed( | 91 void ExtensionToolbarIconSurfacingBubble::ButtonPressed( |
| 91 views::Button* sender, | 92 views::Button* sender, |
| 92 const ui::Event& event) { | 93 const ui::Event& event) { |
| 93 delegate_->OnBubbleClosed(ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE); | 94 delegate_->OnBubbleClosed(ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE); |
| 94 acknowledged_ = true; | 95 acknowledged_ = true; |
| 95 GetWidget()->Close(); | 96 GetWidget()->Close(); |
| 96 } | 97 } |
| OLD | NEW |