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

Side by Side Diff: chrome/browser/ui/views/location_bar/content_setting_image_view.h

Issue 2668833003: DialogBrowserTest implementation to invoke Content settings bubble dialogs. (Closed)
Patch Set: Merge fix from https://codereview.chromium.org/2663163004. This is temporary Created 3 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 29 matching lines...) Expand all
40 public views::WidgetObserver { 40 public views::WidgetObserver {
41 public: 41 public:
42 ContentSettingImageView(std::unique_ptr<ContentSettingImageModel> image_model, 42 ContentSettingImageView(std::unique_ptr<ContentSettingImageModel> image_model,
43 LocationBarView* parent, 43 LocationBarView* parent,
44 const gfx::FontList& font_list); 44 const gfx::FontList& font_list);
45 ~ContentSettingImageView() override; 45 ~ContentSettingImageView() override;
46 46
47 // Updates the decoration from the shown WebContents. 47 // Updates the decoration from the shown WebContents.
48 void Update(content::WebContents* web_contents); 48 void Update(content::WebContents* web_contents);
49 49
50 // For testing. Return this view's ContentSettingImageModel.
Peter Kasting 2017/02/06 21:14:25 Nit: Returns (2 places) "For testing" sounds like
51 ContentSettingImageModel* content_setting_image_model() {
52 return content_setting_image_model_.get();
53 }
54
50 private: 55 private:
56 friend class ContentSettingBubbleDialogTest;
57
51 // The total animation time, including open and close as well as an 58 // The total animation time, including open and close as well as an
52 // intervening "stay open" period. 59 // intervening "stay open" period.
53 static const int kAnimationDurationMS; 60 static const int kAnimationDurationMS;
54 61
55 // IconLabelBubbleView: 62 // IconLabelBubbleView:
56 const char* GetClassName() const override; 63 const char* GetClassName() const override;
57 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; 64 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
58 bool OnMousePressed(const ui::MouseEvent& event) override; 65 bool OnMousePressed(const ui::MouseEvent& event) override;
59 void OnMouseReleased(const ui::MouseEvent& event) override; 66 void OnMouseReleased(const ui::MouseEvent& event) override;
60 void OnGestureEvent(ui::GestureEvent* event) override; 67 void OnGestureEvent(ui::GestureEvent* event) override;
(...skipping 12 matching lines...) Expand all
73 void AnimationProgressed(const gfx::Animation* animation) override; 80 void AnimationProgressed(const gfx::Animation* animation) override;
74 void AnimationCanceled(const gfx::Animation* animation) override; 81 void AnimationCanceled(const gfx::Animation* animation) override;
75 82
76 // views::WidgetObserver: 83 // views::WidgetObserver:
77 void OnWidgetDestroying(views::Widget* widget) override; 84 void OnWidgetDestroying(views::Widget* widget) override;
78 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; 85 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override;
79 86
80 // Updates the image and tooltip to match the current model state. 87 // Updates the image and tooltip to match the current model state.
81 void UpdateImage(); 88 void UpdateImage();
82 89
90 // Return the currently active bubble dialog. Used for testing.
91 views::BubbleDialogDelegateView* bubble_view() {
92 return bubble_view_;
93 }
94
83 LocationBarView* parent_; // Weak, owns us. 95 LocationBarView* parent_; // Weak, owns us.
84 std::unique_ptr<ContentSettingImageModel> content_setting_image_model_; 96 std::unique_ptr<ContentSettingImageModel> content_setting_image_model_;
85 gfx::SlideAnimation slide_animator_; 97 gfx::SlideAnimation slide_animator_;
86 bool pause_animation_; 98 bool pause_animation_;
87 double pause_animation_state_; 99 double pause_animation_state_;
88 views::BubbleDialogDelegateView* bubble_view_; 100 views::BubbleDialogDelegateView* bubble_view_;
89 101
90 // This is used to check if the bubble was showing during the mouse pressed 102 // This is used to check if the bubble was showing during the mouse pressed
91 // event. If this is true then the mouse released event is ignored to prevent 103 // event. If this is true then the mouse released event is ignored to prevent
92 // the bubble from reshowing. 104 // the bubble from reshowing.
93 bool suppress_mouse_released_action_; 105 bool suppress_mouse_released_action_;
94 106
95 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); 107 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView);
96 }; 108 };
97 109
98 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ 110 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698