| 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/intent_picker_bubble_view.h" | 5 #include "chrome/browser/ui/views/intent_picker_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/ui/browser_dialogs.h" |
| 12 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.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/toolbar/toolbar_view.h" | 15 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 15 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 16 #include "content/public/browser/navigation_handle.h" | 17 #include "content/public/browser/navigation_handle.h" |
| 17 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
| 20 #include "ui/views/animation/ink_drop_host_view.h" | 21 #include "ui/views/animation/ink_drop_host_view.h" |
| 21 #include "ui/views/border.h" | 22 #include "ui/views/border.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 IntentPickerBubbleView::IntentPickerBubbleView( | 219 IntentPickerBubbleView::IntentPickerBubbleView( |
| 219 const std::vector<AppInfo>& app_info, | 220 const std::vector<AppInfo>& app_info, |
| 220 IntentPickerResponse intent_picker_cb, | 221 IntentPickerResponse intent_picker_cb, |
| 221 content::WebContents* web_contents) | 222 content::WebContents* web_contents) |
| 222 : views::BubbleDialogDelegateView(nullptr /* anchor_view */, | 223 : views::BubbleDialogDelegateView(nullptr /* anchor_view */, |
| 223 views::BubbleBorder::TOP_CENTER), | 224 views::BubbleBorder::TOP_CENTER), |
| 224 WebContentsObserver(web_contents), | 225 WebContentsObserver(web_contents), |
| 225 intent_picker_cb_(intent_picker_cb), | 226 intent_picker_cb_(intent_picker_cb), |
| 226 selected_app_tag_(0), | 227 selected_app_tag_(0), |
| 227 scroll_view_(nullptr), | 228 scroll_view_(nullptr), |
| 228 app_info_(app_info) {} | 229 app_info_(app_info) { |
| 230 chrome::RecordDialogCreation(chrome::DialogIdentifier::INTENT_PICKER); |
| 231 } |
| 229 | 232 |
| 230 IntentPickerBubbleView::~IntentPickerBubbleView() { | 233 IntentPickerBubbleView::~IntentPickerBubbleView() { |
| 231 SetLayoutManager(nullptr); | 234 SetLayoutManager(nullptr); |
| 232 } | 235 } |
| 233 | 236 |
| 234 // If the widget gets closed without an app being selected we still need to use | 237 // If the widget gets closed without an app being selected we still need to use |
| 235 // the callback so the caller can Resume the navigation. | 238 // the callback so the caller can Resume the navigation. |
| 236 void IntentPickerBubbleView::OnWidgetDestroying(views::Widget* widget) { | 239 void IntentPickerBubbleView::OnWidgetDestroying(views::Widget* widget) { |
| 237 RunCallback(kInvalidPackageName, | 240 RunCallback(kInvalidPackageName, |
| 238 arc::ArcNavigationThrottle::CloseReason::DIALOG_DEACTIVATED); | 241 arc::ArcNavigationThrottle::CloseReason::DIALOG_DEACTIVATED); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 size_t index) { | 341 size_t index) { |
| 339 return GetIntentPickerLabelButtonAt(index)->GetTargetInkDropState(); | 342 return GetIntentPickerLabelButtonAt(index)->GetTargetInkDropState(); |
| 340 } | 343 } |
| 341 | 344 |
| 342 void IntentPickerBubbleView::PressButtonForTesting(size_t index, | 345 void IntentPickerBubbleView::PressButtonForTesting(size_t index, |
| 343 const ui::Event& event) { | 346 const ui::Event& event) { |
| 344 views::Button* button = | 347 views::Button* button = |
| 345 static_cast<views::Button*>(GetIntentPickerLabelButtonAt(index)); | 348 static_cast<views::Button*>(GetIntentPickerLabelButtonAt(index)); |
| 346 ButtonPressed(button, event); | 349 ButtonPressed(button, event); |
| 347 } | 350 } |
| OLD | NEW |