Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(985)

Side by Side Diff: chrome/browser/ui/views/intent_picker_bubble_view.h

Issue 2134293002: Adding a ScrollView for IntentPickerBubbleView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the last test failing, moving the order of excecution and getting rid of the override SetUp(). Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 ~IntentPickerBubbleView() override;
66 66
67 protected: 67 protected:
68 // views::BubbleDialogDelegateView overrides: 68 // views::BubbleDialogDelegateView overrides:
69 void Init() override; 69 void Init() override;
70 70
71 private: 71 private:
72 friend class IntentPickerBubbleViewTest;
Yusuke Sato 2016/07/19 10:23:58 Another way to allow the test to access internals
djacobo_ 2016/07/20 21:18:30 Done.
73 FRIEND_TEST_ALL_PREFIXES(IntentPickerBubbleViewTest, NullIcons);
Yusuke Sato 2016/07/20 08:05:54 Or, if you go with friend, can you remove line 73-
djacobo_ 2016/07/20 21:18:30 Done.
74 FRIEND_TEST_ALL_PREFIXES(IntentPickerBubbleViewTest, NonNullIcons);
75 FRIEND_TEST_ALL_PREFIXES(IntentPickerBubbleViewTest, LabelsPtrVectorSize);
72 IntentPickerBubbleView(const std::vector<NameAndIcon>& app_info, 76 IntentPickerBubbleView(const std::vector<NameAndIcon>& app_info,
73 ThrottleCallback throttle_cb, 77 ThrottleCallback throttle_cb,
74 content::WebContents* web_contents); 78 content::WebContents* web_contents,
75 ~IntentPickerBubbleView() override; 79 bool was_callback_run);
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;
86 90
87 // content::WebContentsObserver overrides: 91 // content::WebContentsObserver overrides:
88 void WebContentsDestroyed() override; 92 void WebContentsDestroyed() override;
89 93
90 // Flag set to true iff the callback was Run at some previous step, used to 94 // Flag set to true iff the callback was Run at some previous step, used to
91 // ensure we only use the callback once. 95 // ensure we only use the callback once.
92 bool was_callback_run_; 96 bool was_callback_run_;
93 97
94 // Callback used to respond to ArcNavigationThrottle. 98 // Callback used to respond to ArcNavigationThrottle.
95 ThrottleCallback throttle_cb_; 99 ThrottleCallback throttle_cb_;
96 100
97 // Keeps a invalid value unless the user explicitly makes a decision. 101 // Keeps a invalid value unless the user explicitly makes a decision.
98 size_t selected_app_tag_; 102 size_t selected_app_tag_;
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_;
108 std::vector<views::LabelButton*> app_label_ptr_;
Yusuke Sato 2016/07/19 10:23:58 Is this really necessary? I'm not familiar with Vi
djacobo_ 2016/07/20 21:18:30 Removed, opting for the GetViewByID() method you s
104 109
105 DISALLOW_COPY_AND_ASSIGN(IntentPickerBubbleView); 110 DISALLOW_COPY_AND_ASSIGN(IntentPickerBubbleView);
106 }; 111 };
107 112
108 #endif // CHROME_BROWSER_UI_VIEWS_INTENT_PICKER_BUBBLE_VIEW_H_ 113 #endif // CHROME_BROWSER_UI_VIEWS_INTENT_PICKER_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698