Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_UI_VIEWS_INTENT_PICKER_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_INTENT_PICKER_BUBBLE_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_INTENT_PICKER_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_INTENT_PICKER_BUBBLE_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/browser/chromeos/arc/arc_navigation_throttle.h" | 13 #include "chrome/browser/chromeos/arc/arc_navigation_throttle.h" |
| 14 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
| 15 #include "ui/gfx/image/image.h" | 15 #include "ui/gfx/image/image.h" |
| 16 #include "ui/views/bubble/bubble_dialog_delegate.h" | 16 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 17 #include "ui/views/controls/button/button.h" | 17 #include "ui/views/controls/button/button.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 class NavigationHandle; | 20 class NavigationHandle; |
| 21 } // namespace content | 21 } // namespace content |
| 22 | 22 |
| 23 namespace views { | 23 namespace views { |
| 24 class EventMonitor; | |
| 25 class Label; | 24 class Label; |
| 26 class LabelButton; | 25 class LabelButton; |
| 27 class View; | 26 class View; |
| 28 class Widget; | 27 class Widget; |
| 29 } // namespace views | 28 } // namespace views |
| 30 | 29 |
| 31 namespace ui { | 30 namespace ui { |
| 32 class Event; | 31 class Event; |
| 33 } // namespace ui | 32 } // namespace ui |
| 34 | 33 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 56 // the reason why the Bubble was closed. The size_t param must have a value in | 55 // the reason why the Bubble was closed. The size_t param must have a value in |
| 57 // the range [0, app_info.size()-1], except when the CloseReason is ERROR or | 56 // the range [0, app_info.size()-1], except when the CloseReason is ERROR or |
| 58 // DIALOG_DEACTIVATED, for these cases we return a dummy value | 57 // DIALOG_DEACTIVATED, for these cases we return a dummy value |
| 59 // |kAppTagNoneSelected| which won't be used at all and has no significance. | 58 // |kAppTagNoneSelected| which won't be used at all and has no significance. |
| 60 using ThrottleCallback = | 59 using ThrottleCallback = |
| 61 base::Callback<void(size_t, arc::ArcNavigationThrottle::CloseReason)>; | 60 base::Callback<void(size_t, arc::ArcNavigationThrottle::CloseReason)>; |
| 62 | 61 |
| 63 static void ShowBubble(content::NavigationHandle* handle, | 62 static void ShowBubble(content::NavigationHandle* handle, |
| 64 const std::vector<NameAndIcon>& app_info, | 63 const std::vector<NameAndIcon>& app_info, |
| 65 const ThrottleCallback& throttle_cb); | 64 const ThrottleCallback& throttle_cb); |
| 65 static std::unique_ptr<IntentPickerBubbleView> CreateBubbleForTesting( | |
| 66 const std::vector<NameAndIcon>& app_info, | |
| 67 const ThrottleCallback& throttle_cb, | |
| 68 content::WebContents* web_contents); | |
| 69 size_t GetNumberOfAppLabelsForTesting(); | |
|
Yusuke Sato
2016/07/20 21:58:57
* optional: feel free to rename this to a shorter
djacobo_
2016/07/21 16:04:11
Done.
| |
| 70 ~IntentPickerBubbleView() override; | |
|
Yusuke Sato
2016/07/20 21:58:57
move to line 61?
djacobo_
2016/07/21 16:04:11
Done.
| |
| 66 | 71 |
| 67 protected: | 72 protected: |
| 68 // views::BubbleDialogDelegateView overrides: | 73 // views::BubbleDialogDelegateView overrides: |
| 69 void Init() override; | 74 void Init() override; |
| 70 | 75 |
| 71 private: | 76 private: |
| 72 IntentPickerBubbleView(const std::vector<NameAndIcon>& app_info, | 77 IntentPickerBubbleView(const std::vector<NameAndIcon>& app_info, |
| 73 ThrottleCallback throttle_cb, | 78 ThrottleCallback throttle_cb, |
| 74 content::WebContents* web_contents); | 79 content::WebContents* web_contents); |
| 75 ~IntentPickerBubbleView() override; | |
| 76 | 80 |
| 77 // views::BubbleDialogDelegateView overrides: | 81 // views::BubbleDialogDelegateView overrides: |
| 78 void OnWidgetDestroying(views::Widget* widget) override; | 82 void OnWidgetDestroying(views::Widget* widget) override; |
| 79 int GetDialogButtons() const override; | 83 int GetDialogButtons() const override; |
| 80 | 84 |
| 81 // views::ButtonListener overrides: | 85 // views::ButtonListener overrides: |
| 82 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 86 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 83 | 87 |
| 84 // views::View overrides: | 88 // views::View overrides: |
| 85 gfx::Size GetPreferredSize() const override; | 89 gfx::Size GetPreferredSize() const override; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 99 | 103 |
| 100 views::LabelButton* always_button_; | 104 views::LabelButton* always_button_; |
| 101 views::LabelButton* just_once_button_; | 105 views::LabelButton* just_once_button_; |
| 102 | 106 |
| 103 std::vector<NameAndIcon> app_info_; | 107 std::vector<NameAndIcon> app_info_; |
| 104 | 108 |
| 105 DISALLOW_COPY_AND_ASSIGN(IntentPickerBubbleView); | 109 DISALLOW_COPY_AND_ASSIGN(IntentPickerBubbleView); |
| 106 }; | 110 }; |
| 107 | 111 |
| 108 #endif // CHROME_BROWSER_UI_VIEWS_INTENT_PICKER_BUBBLE_VIEW_H_ | 112 #endif // CHROME_BROWSER_UI_VIEWS_INTENT_PICKER_BUBBLE_VIEW_H_ |
| OLD | NEW |