| 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/ime/ime_warning_bubble_view.h" | 5 #include "chrome/browser/ui/views/ime/ime_warning_bubble_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h" | 10 #include "chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h" |
| 11 #include "chrome/browser/platform_util.h" | 11 #include "chrome/browser/platform_util.h" |
| 12 #include "chrome/browser/ui/browser_dialogs.h" |
| 12 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
| 13 #include "chrome/browser/ui/views/frame/browser_view.h" | 14 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 14 #include "chrome/browser/ui/views/harmony/chrome_typography.h" | 15 #include "chrome/browser/ui/views/harmony/chrome_typography.h" |
| 15 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" | 16 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
| 16 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 17 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 17 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 18 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 18 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 19 #include "extensions/common/feature_switch.h" | 20 #include "extensions/common/feature_switch.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 InitLayout(); | 113 InitLayout(); |
| 113 | 114 |
| 114 // If the toolbar is not animating, shows the warning bubble directly. | 115 // If the toolbar is not animating, shows the warning bubble directly. |
| 115 // Otherwise, shows the bubble in method OnToolbarActionsBarAnimationEnded(). | 116 // Otherwise, shows the bubble in method OnToolbarActionsBarAnimationEnded(). |
| 116 if (IsToolbarAnimating()) { | 117 if (IsToolbarAnimating()) { |
| 117 toolbar_actions_bar_observer_.Add(toolbar_actions_bar_); | 118 toolbar_actions_bar_observer_.Add(toolbar_actions_bar_); |
| 118 return; | 119 return; |
| 119 } | 120 } |
| 120 views::BubbleDialogDelegateView::CreateBubble(this)->Show(); | 121 views::BubbleDialogDelegateView::CreateBubble(this)->Show(); |
| 121 bubble_has_shown_ = true; | 122 bubble_has_shown_ = true; |
| 123 chrome::RecordDialogCreation(chrome::DialogIdentifier::IME_WARNING); |
| 122 } | 124 } |
| 123 | 125 |
| 124 ImeWarningBubbleView::~ImeWarningBubbleView() { | 126 ImeWarningBubbleView::~ImeWarningBubbleView() { |
| 125 if (!response_callback_.is_null()) { | 127 if (!response_callback_.is_null()) { |
| 126 base::ResetAndReturn(&response_callback_) | 128 base::ResetAndReturn(&response_callback_) |
| 127 .Run(ImeWarningBubblePermissionStatus::ABORTED); | 129 .Run(ImeWarningBubblePermissionStatus::ABORTED); |
| 128 } | 130 } |
| 129 | 131 |
| 130 BrowserList::RemoveObserver(this); | 132 BrowserList::RemoveObserver(this); |
| 131 } | 133 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 layout->StartRow(0, cs_id); | 186 layout->StartRow(0, cs_id); |
| 185 never_show_checkbox_ = | 187 never_show_checkbox_ = |
| 186 new views::Checkbox(l10n_util::GetStringUTF16(IDS_IME_API_NEVER_SHOW)); | 188 new views::Checkbox(l10n_util::GetStringUTF16(IDS_IME_API_NEVER_SHOW)); |
| 187 layout->AddView(never_show_checkbox_); | 189 layout->AddView(never_show_checkbox_); |
| 188 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 190 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 189 } | 191 } |
| 190 | 192 |
| 191 bool ImeWarningBubbleView::IsToolbarAnimating() { | 193 bool ImeWarningBubbleView::IsToolbarAnimating() { |
| 192 return anchor_to_browser_action_ && container_->animating(); | 194 return anchor_to_browser_action_ && container_->animating(); |
| 193 } | 195 } |
| OLD | NEW |