| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/toolbar_actions_bar_bubble_views.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" | 7 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" |
| 8 #include "chrome/browser/ui/view_ids.h" | 8 #include "chrome/browser/ui/view_ids.h" |
| 9 #include "chrome/grit/locale_settings.h" | 9 #include "chrome/grit/locale_settings.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 int ToolbarActionsBarBubbleViews::GetDialogButtons() const { | 98 int ToolbarActionsBarBubbleViews::GetDialogButtons() const { |
| 99 int buttons = ui::DIALOG_BUTTON_OK; | 99 int buttons = ui::DIALOG_BUTTON_OK; |
| 100 if (!delegate_->GetDismissButtonText().empty()) | 100 if (!delegate_->GetDismissButtonText().empty()) |
| 101 buttons |= ui::DIALOG_BUTTON_CANCEL; | 101 buttons |= ui::DIALOG_BUTTON_CANCEL; |
| 102 return buttons; | 102 return buttons; |
| 103 } | 103 } |
| 104 | 104 |
| 105 int ToolbarActionsBarBubbleViews::GetDefaultDialogButton() const { |
| 106 // TODO(estade): we should set a default where approprite. See |
| 107 // http://crbug.com/621122 |
| 108 return ui::DIALOG_BUTTON_NONE; |
| 109 } |
| 110 |
| 105 base::string16 ToolbarActionsBarBubbleViews::GetDialogButtonLabel( | 111 base::string16 ToolbarActionsBarBubbleViews::GetDialogButtonLabel( |
| 106 ui::DialogButton button) const { | 112 ui::DialogButton button) const { |
| 107 return button == ui::DIALOG_BUTTON_OK ? delegate_->GetActionButtonText() | 113 return button == ui::DIALOG_BUTTON_OK ? delegate_->GetActionButtonText() |
| 108 : delegate_->GetDismissButtonText(); | 114 : delegate_->GetDismissButtonText(); |
| 109 } | 115 } |
| 110 | 116 |
| 111 void ToolbarActionsBarBubbleViews::LinkClicked(views::Link* link, | 117 void ToolbarActionsBarBubbleViews::LinkClicked(views::Link* link, |
| 112 int event_flags) { | 118 int event_flags) { |
| 113 delegate_->OnBubbleClosed(ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE); | 119 delegate_->OnBubbleClosed(ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE); |
| 114 // Reset delegate so we don't send extra OnBubbleClosed()s. | 120 // Reset delegate so we don't send extra OnBubbleClosed()s. |
| 115 delegate_.reset(); | 121 delegate_.reset(); |
| 116 GetWidget()->Close(); | 122 GetWidget()->Close(); |
| 117 } | 123 } |
| OLD | NEW |