| Index: chrome/browser/ui/views/intent_picker_bubble_view.h
|
| diff --git a/chrome/browser/ui/views/intent_picker_bubble_view.h b/chrome/browser/ui/views/intent_picker_bubble_view.h
|
| index e811528ccc8e59d82d0f8423022908a6e546e19e..9bd77ccc0a4838763b8874aedd0803e8892032fd 100644
|
| --- a/chrome/browser/ui/views/intent_picker_bubble_view.h
|
| +++ b/chrome/browser/ui/views/intent_picker_bubble_view.h
|
| @@ -31,6 +31,8 @@ namespace ui {
|
| class Event;
|
| } // namespace ui
|
|
|
| +class IntentPickerLabelButton;
|
| +
|
| // A bubble that displays a list of aplications (icons and names), after the
|
| // list we show a pair of buttons which allow the user to remember the selection
|
| // or not. This class comunicates the user's selection with a callback used by
|
| @@ -56,34 +58,49 @@ class IntentPickerBubbleView : public views::BubbleDialogDelegateView,
|
| // the range [0, app_info.size()-1], except when the CloseReason is ERROR or
|
| // DIALOG_DEACTIVATED, for these cases we return a dummy value
|
| // |kAppTagNoneSelected| which won't be used at all and has no significance.
|
| - using ThrottleCallback =
|
| + using IntentPickerResponse =
|
| base::Callback<void(size_t, arc::ArcNavigationThrottle::CloseReason)>;
|
|
|
| ~IntentPickerBubbleView() override;
|
| static void ShowBubble(content::WebContents* web_contents,
|
| const std::vector<NameAndIcon>& app_info,
|
| - const ThrottleCallback& throttle_cb);
|
| + const IntentPickerResponse& intent_picker_cb);
|
| static std::unique_ptr<IntentPickerBubbleView> CreateBubbleView(
|
| const std::vector<NameAndIcon>& app_info,
|
| - const ThrottleCallback& throttle_cb,
|
| + const IntentPickerResponse& intent_picker_cb,
|
| content::WebContents* web_contents);
|
|
|
| + // views::DialogDelegate overrides:
|
| + bool Accept() override;
|
| + bool Cancel() override;
|
| + bool Close() override;
|
| + int GetDefaultDialogButton() const override;
|
| +
|
| protected:
|
| // views::BubbleDialogDelegateView overrides:
|
| void Init() override;
|
|
|
| + // views::DialogDelegate overrides:
|
| + bool IsDialogButtonEnabled(ui::DialogButton button) const override;
|
| +
|
| + // views::WidgetDelegate overrides:
|
| + base::string16 GetWindowTitle() const override;
|
| + base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
|
| +
|
| private:
|
| friend class IntentPickerBubbleViewTest;
|
| FRIEND_TEST_ALL_PREFIXES(IntentPickerBubbleViewTest, NullIcons);
|
| FRIEND_TEST_ALL_PREFIXES(IntentPickerBubbleViewTest, NonNullIcons);
|
| FRIEND_TEST_ALL_PREFIXES(IntentPickerBubbleViewTest, LabelsPtrVectorSize);
|
| + FRIEND_TEST_ALL_PREFIXES(IntentPickerBubbleViewTest, VerifyStartingInkDrop);
|
| + FRIEND_TEST_ALL_PREFIXES(IntentPickerBubbleViewTest, InkDropStateTransition);
|
| + FRIEND_TEST_ALL_PREFIXES(IntentPickerBubbleViewTest, PressButtonTwice);
|
| IntentPickerBubbleView(const std::vector<NameAndIcon>& app_info,
|
| - ThrottleCallback throttle_cb,
|
| + IntentPickerResponse intent_picker_cb,
|
| content::WebContents* web_contents);
|
|
|
| // views::BubbleDialogDelegateView overrides:
|
| void OnWidgetDestroying(views::Widget* widget) override;
|
| - int GetDialogButtons() const override;
|
|
|
| // views::ButtonListener overrides:
|
| void ButtonPressed(views::Button* sender, const ui::Event& event) override;
|
| @@ -94,23 +111,20 @@ class IntentPickerBubbleView : public views::BubbleDialogDelegateView,
|
| // content::WebContentsObserver overrides:
|
| void WebContentsDestroyed() override;
|
|
|
| - // Retrieves the LabelButton* contained at position |index| from the internal
|
| - // ScrollView.
|
| - views::LabelButton* GetLabelButtonAt(size_t index);
|
| - void SetLabelButtonBackgroundColor(size_t index, SkColor color);
|
| + // Retrieves the IntentPickerLabelButton* contained at position |index| from
|
| + // the internal ScrollView.
|
| + IntentPickerLabelButton* GetIntentPickerLabelButtonAt(size_t index);
|
|
|
| - // Flag set to true iff the callback was Run at some previous step, used to
|
| - // ensure we only use the callback once.
|
| - bool was_callback_run_;
|
| + gfx::ImageSkia GetAppImageForTesting(size_t index);
|
| + views::InkDropState GetInkDropStateForTesting(size_t);
|
| + void PressButtonForTesting(size_t index, const ui::Event& event);
|
|
|
| // Callback used to respond to ArcNavigationThrottle.
|
| - ThrottleCallback throttle_cb_;
|
| + IntentPickerResponse intent_picker_cb_;
|
|
|
| // Keeps a invalid value unless the user explicitly makes a decision.
|
| size_t selected_app_tag_;
|
|
|
| - views::LabelButton* always_button_;
|
| - views::LabelButton* just_once_button_;
|
| views::ScrollView* scroll_view_;
|
|
|
| std::vector<NameAndIcon> app_info_;
|
|
|