| OLD | NEW |
| 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 26 matching lines...) Expand all Loading... |
| 37 // The ContentSettingImageView displays an icon and optional text label for | 37 // The ContentSettingImageView displays an icon and optional text label for |
| 38 // various content settings affordances in the location bar (i.e. plugin | 38 // various content settings affordances in the location bar (i.e. plugin |
| 39 // blocking, geolocation). | 39 // blocking, geolocation). |
| 40 class ContentSettingImageView : public IconLabelBubbleView, | 40 class ContentSettingImageView : public IconLabelBubbleView, |
| 41 public gfx::AnimationDelegate, | 41 public gfx::AnimationDelegate, |
| 42 public views::WidgetObserver { | 42 public views::WidgetObserver { |
| 43 public: | 43 public: |
| 44 // ContentSettingImageView takes ownership of its |image_model|. | 44 // ContentSettingImageView takes ownership of its |image_model|. |
| 45 ContentSettingImageView(ContentSettingImageModel* image_model, | 45 ContentSettingImageView(ContentSettingImageModel* image_model, |
| 46 LocationBarView* parent, | 46 LocationBarView* parent, |
| 47 const gfx::FontList& font_list, | 47 const gfx::FontList& font_list); |
| 48 SkColor parent_background_color); | |
| 49 ~ContentSettingImageView() override; | 48 ~ContentSettingImageView() override; |
| 50 | 49 |
| 51 // Updates the decoration from the shown WebContents. | 50 // Updates the decoration from the shown WebContents. |
| 52 void Update(content::WebContents* web_contents); | 51 void Update(content::WebContents* web_contents); |
| 53 | 52 |
| 54 private: | 53 private: |
| 55 // The total animation time, including open and close as well as an | 54 // The total animation time, including open and close as well as an |
| 56 // intervening "stay open" period. | 55 // intervening "stay open" period. |
| 57 static const int kAnimationDurationMS; | 56 static const int kAnimationDurationMS; |
| 58 | 57 |
| 59 // IconLabelBubbleView: | 58 // IconLabelBubbleView: |
| 60 const char* GetClassName() const override; | 59 const char* GetClassName() const override; |
| 61 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; | 60 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
| 62 bool OnMousePressed(const ui::MouseEvent& event) override; | 61 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 63 void OnMouseReleased(const ui::MouseEvent& event) override; | 62 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 64 void OnGestureEvent(ui::GestureEvent* event) override; | 63 void OnGestureEvent(ui::GestureEvent* event) override; |
| 65 bool GetTooltipText(const gfx::Point& p, | 64 bool GetTooltipText(const gfx::Point& p, |
| 66 base::string16* tooltip) const override; | 65 base::string16* tooltip) const override; |
| 67 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; | 66 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; |
| 68 bool ShouldShowInkDropForFocus() const override; | 67 bool ShouldShowInkDropForFocus() const override; |
| 69 SkColor GetTextColor() const override; | 68 SkColor GetTextColor() const override; |
| 70 SkColor GetBorderColor() const override; | 69 bool ShouldShowLabel() const override; |
| 71 bool ShouldShowBackground() const override; | |
| 72 double WidthMultiplier() const override; | 70 double WidthMultiplier() const override; |
| 73 bool IsShrinking() const override; | 71 bool IsShrinking() const override; |
| 74 bool OnActivate(const ui::Event& event) override; | 72 bool OnActivate(const ui::Event& event) override; |
| 75 | 73 |
| 76 // gfx::AnimationDelegate: | 74 // gfx::AnimationDelegate: |
| 77 void AnimationEnded(const gfx::Animation* animation) override; | 75 void AnimationEnded(const gfx::Animation* animation) override; |
| 78 void AnimationProgressed(const gfx::Animation* animation) override; | 76 void AnimationProgressed(const gfx::Animation* animation) override; |
| 79 void AnimationCanceled(const gfx::Animation* animation) override; | 77 void AnimationCanceled(const gfx::Animation* animation) override; |
| 80 | 78 |
| 81 // views::WidgetObserver: | 79 // views::WidgetObserver: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 94 | 92 |
| 95 // This is used to check if the bubble was showing during the mouse pressed | 93 // This is used to check if the bubble was showing during the mouse pressed |
| 96 // event. If this is true then the mouse released event is ignored to prevent | 94 // event. If this is true then the mouse released event is ignored to prevent |
| 97 // the bubble from reshowing. | 95 // the bubble from reshowing. |
| 98 bool suppress_mouse_released_action_; | 96 bool suppress_mouse_released_action_; |
| 99 | 97 |
| 100 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); | 98 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); |
| 101 }; | 99 }; |
| 102 | 100 |
| 103 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ | 101 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ |
| OLD | NEW |