| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "chrome/browser/ui/views/bubble/bubble.h" | 11 #include "chrome/browser/ui/views/bubble/bubble.h" |
| 12 #include "chrome/common/content_settings_types.h" | 12 #include "chrome/common/content_settings_types.h" |
| 13 #include "ui/base/animation/linear_animation.h" | 13 #include "ui/base/animation/linear_animation.h" |
| 14 #include "views/controls/image_view.h" | 14 #include "views/controls/image_view.h" |
| 15 | 15 |
| 16 class ContentSettingImageModel; | 16 class ContentSettingImageModel; |
| 17 class Bubble; | 17 class Bubble; |
| 18 class LocationBarView; | 18 class LocationBarView; |
| 19 class Profile; | |
| 20 class TabContents; | 19 class TabContents; |
| 21 | 20 |
| 22 namespace views { | 21 namespace views { |
| 23 class MouseEvent; | 22 class MouseEvent; |
| 24 } | 23 } |
| 25 | 24 |
| 26 class ContentSettingImageView : public views::ImageView, | 25 class ContentSettingImageView : public views::ImageView, |
| 27 public BubbleDelegate, | 26 public BubbleDelegate, |
| 28 public ui::LinearAnimation { | 27 public ui::LinearAnimation { |
| 29 public: | 28 public: |
| 30 ContentSettingImageView(ContentSettingsType content_type, | 29 ContentSettingImageView(ContentSettingsType content_type, |
| 31 LocationBarView* parent, | 30 LocationBarView* parent); |
| 32 Profile* profile); | |
| 33 virtual ~ContentSettingImageView(); | 31 virtual ~ContentSettingImageView(); |
| 34 | 32 |
| 35 void set_profile(Profile* profile) { profile_ = profile; } | |
| 36 // |new_navigation| true if this is a new navigation, false if the tab was | 33 // |new_navigation| true if this is a new navigation, false if the tab was |
| 37 // just switched to. | 34 // just switched to. |
| 38 void UpdateFromTabContents(TabContents* tab_contents); | 35 void UpdateFromTabContents(TabContents* tab_contents); |
| 39 | 36 |
| 40 // views::View overrides: | 37 // views::View overrides: |
| 41 virtual gfx::Size GetPreferredSize(); | 38 virtual gfx::Size GetPreferredSize(); |
| 42 | 39 |
| 43 private: | 40 private: |
| 44 // views::ImageView overrides: | 41 // views::ImageView overrides: |
| 45 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 42 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
| 46 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | 43 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; |
| 47 virtual void VisibilityChanged(View* starting_from, bool is_visible) OVERRIDE; | 44 virtual void VisibilityChanged(View* starting_from, bool is_visible) OVERRIDE; |
| 48 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 45 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 49 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; | 46 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; |
| 50 | 47 |
| 51 // BubbleDelegate overrides: | 48 // BubbleDelegate overrides: |
| 52 virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape) OVERRIDE; | 49 virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape) OVERRIDE; |
| 53 virtual bool CloseOnEscape() OVERRIDE; | 50 virtual bool CloseOnEscape() OVERRIDE; |
| 54 virtual bool FadeInOnShow() OVERRIDE; | 51 virtual bool FadeInOnShow() OVERRIDE; |
| 55 | 52 |
| 56 // ui::LinearAnimation override: | 53 // ui::LinearAnimation override: |
| 57 virtual void AnimateToState(double state) OVERRIDE; | 54 virtual void AnimateToState(double state) OVERRIDE; |
| 58 | 55 |
| 59 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; | 56 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; |
| 60 | 57 |
| 61 // The owning LocationBarView. | 58 // The owning LocationBarView. |
| 62 LocationBarView* parent_; | 59 LocationBarView* parent_; |
| 63 | 60 |
| 64 // The currently active profile. | |
| 65 Profile* profile_; | |
| 66 | |
| 67 // The currently shown info bubble if any. | 61 // The currently shown info bubble if any. |
| 68 Bubble* bubble_; | 62 Bubble* bubble_; |
| 69 | 63 |
| 70 string16 animated_text_; | 64 string16 animated_text_; |
| 71 bool animation_in_progress_; | 65 bool animation_in_progress_; |
| 72 int text_size_; | 66 int text_size_; |
| 73 int visible_text_size_; | 67 int visible_text_size_; |
| 74 gfx::Insets saved_insets_; | 68 gfx::Insets saved_insets_; |
| 75 | 69 |
| 76 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingImageView); | 70 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingImageView); |
| 77 }; | 71 }; |
| 78 | 72 |
| 79 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ | 73 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ |
| OLD | NEW |