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

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

Issue 10821114: Refactor the content setting view to allow a subclass for the web intents button. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix methods. Created 8 years, 4 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 | Annotate | Revision Log
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 "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
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/location_bar/touchable_location_bar_view.h" 11 #include "chrome/browser/ui/views/location_bar/touchable_location_bar_view.h"
12 #include "chrome/common/content_settings_types.h" 12 #include "chrome/common/content_settings_types.h"
13 #include "ui/base/animation/animation_delegate.h" 13 #include "ui/base/animation/animation_delegate.h"
14 #include "ui/views/controls/image_view.h" 14 #include "ui/views/controls/image_view.h"
15 #include "ui/views/widget/widget_observer.h" 15 #include "ui/views/widget/widget_observer.h"
16 16
17 class ContentSettingImageModel; 17 class ContentSettingImageModel;
18 class ContentSettingBubbleContents; 18 class ContentSettingBubbleContents;
19 class LocationBarView; 19 class LocationBarView;
20 class TabContents;
20 21
21 namespace content { 22 namespace content {
22 class WebContents; 23 class WebContents;
23 } 24 }
24 25
25 namespace views { 26 namespace views {
27 class GestureEvent;
26 class MouseEvent; 28 class MouseEvent;
27 } 29 }
28 30
29 namespace ui { 31 namespace ui {
30 class SlideAnimation; 32 class SlideAnimation;
33 enum GestureStatus;
31 } 34 }
32 35
33 class ContentSettingsDelegateView; 36 class ContentSettingsDelegateView;
34 37
35 class ContentSettingImageView : public views::ImageView, 38 class ContentSettingImageView : public views::ImageView,
36 public ui::AnimationDelegate, 39 public ui::AnimationDelegate,
37 public views::WidgetObserver, 40 public views::WidgetObserver,
38 public TouchableLocationBarView { 41 public TouchableLocationBarView {
39 public: 42 public:
40 ContentSettingImageView(ContentSettingsType content_type, 43 ContentSettingImageView(ContentSettingsType content_type,
41 LocationBarView* parent); 44 LocationBarView* parent);
42 virtual ~ContentSettingImageView(); 45 virtual ~ContentSettingImageView();
43 46
44 // |new_navigation| true if this is a new navigation, false if the tab was 47 // |new_navigation| true if this is a new navigation, false if the tab was
45 // just switched to. 48 // just switched to.
46 void UpdateFromWebContents(content::WebContents* web_contents); 49 virtual void Update(TabContents* tab_contents);
47 50
48 // views::View overrides: 51 // views::View overrides:
49 virtual gfx::Size GetPreferredSize() OVERRIDE; 52 virtual gfx::Size GetPreferredSize() OVERRIDE;
53 virtual ui::GestureStatus OnGestureEvent(
54 const views::GestureEvent& event) OVERRIDE;
50 55
51 // ui::AnimationDelegate overrides: 56 // ui::AnimationDelegate overrides:
52 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 57 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
53 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 58 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
54 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; 59 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE;
55 60
56 // views::WidgetObserver override: 61 // views::WidgetObserver override:
57 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; 62 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
58 63
59 // TouchableLocationBarView. 64 // TouchableLocationBarView.
60 virtual int GetBuiltInHorizontalPadding() const OVERRIDE; 65 virtual int GetBuiltInHorizontalPadding() const OVERRIDE;
61 66
67 protected:
68 // Provide styling colors for button look.
69 virtual SkColor ButtonBorderColor() const;
70 virtual SkColor GradientTopColor() const;
71 virtual SkColor GradientBottomColor() const;
72
73 // Invoked when the user clicks on the control.
74 virtual void OnClick();
75
62 private: 76 private:
63 // views::ImageView overrides: 77 // views::ImageView overrides:
64 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; 78 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
65 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; 79 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE;
66 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 80 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
67 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; 81 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE;
68 82
69 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; 83 scoped_ptr<ContentSettingImageModel> content_setting_image_model_;
70 84
71 views::Widget* bubble_widget_; 85 views::Widget* bubble_widget_;
72 86
73 // The owning LocationBarView. 87 // The owning LocationBarView.
74 LocationBarView* parent_; 88 LocationBarView* parent_;
75 89
76 scoped_ptr<ui::SlideAnimation> slide_animator_; 90 scoped_ptr<ui::SlideAnimation> slide_animator_;
77 string16 animated_text_; 91 string16 animated_text_;
78 bool pause_animation_; 92 bool pause_animation_;
79 int text_size_; 93 int text_size_;
80 int visible_text_size_; 94 int visible_text_size_;
81 gfx::Insets saved_insets_; 95 gfx::Insets saved_insets_;
82 96
83 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingImageView); 97 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingImageView);
84 }; 98 };
85 99
86 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ 100 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698