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

Unified Diff: chrome/browser/ui/gtk/location_bar_view_gtk.h

Issue 10835020: Refactor location bar content setting image GTK classes to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/location_bar_view_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/location_bar_view_gtk.h
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.h b/chrome/browser/ui/gtk/location_bar_view_gtk.h
index 8ecfa8461d1601528b71f055a955254406af95d4..cccbc0bbff5f2cb38f900db996d57d747a35251c 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.h
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.h
@@ -168,68 +168,66 @@ class LocationBarViewGtk : public OmniboxEditController,
// Edit background color.
static const GdkColor kBackgroundColor;
- private:
- class ContentSettingImageViewGtk : public BubbleDelegateGtk,
- public ui::AnimationDelegate {
+ // Superclass for content settings icons shown at the left side of the
+ // location bar.
+ class PageToolViewGtk : public ui::AnimationDelegate {
public:
- ContentSettingImageViewGtk(ContentSettingsType content_type,
- const LocationBarViewGtk* parent);
- virtual ~ContentSettingImageViewGtk();
+ explicit PageToolViewGtk(const LocationBarViewGtk* parent);
+ virtual ~PageToolViewGtk();
- GtkWidget* widget() { return alignment_.get(); }
+ GtkWidget* widget();
bool IsVisible();
- void UpdateFromWebContents(content::WebContents* web_contents);
+ virtual void Update(TabContents* tab_contents) = 0;
// Overridden from ui::AnimationDelegate:
virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE;
- private:
+ protected:
+ // Theme constants for solid background elements.
+ virtual GdkColor button_border_color() const = 0;
+ virtual GdkColor gradient_top_color() const = 0;
+ virtual GdkColor gradient_bottom_color() const = 0;
+
+ // Delegate for ButtonPressed message.
+ virtual void OnClick(GtkWidget* sender) = 0;
+
// Start the process of showing the label.
void StartAnimating();
// Slide the label shut.
void CloseAnimation();
- CHROMEGTK_CALLBACK_1(ContentSettingImageViewGtk, gboolean, OnButtonPressed,
- GdkEvent*);
- CHROMEGTK_CALLBACK_1(ContentSettingImageViewGtk, gboolean, OnExpose,
- GdkEventExpose*);
-
- // BubbleDelegateGtk overrides:
- virtual void BubbleClosing(BubbleGtk* bubble,
- bool closed_by_escape) OVERRIDE;
-
- scoped_ptr<ContentSettingImageModel> content_setting_image_model_;
+ CHROMEGTK_CALLBACK_1(PageToolViewGtk, gboolean, OnButtonPressed, GdkEvent*);
+ CHROMEGTK_CALLBACK_1(PageToolViewGtk, gboolean, OnExpose, GdkEventExpose*);
- // The widgets for this content settings view.
+ // The widgets for this view.
ui::OwnedWidgetGtk alignment_;
ui::OwnedWidgetGtk event_box_;
GtkWidget* hbox_;
ui::OwnedWidgetGtk image_;
- // Explanatory text ("popup blocked").
+ // Explanatory text (e.g. "popup blocked").
ui::OwnedWidgetGtk label_;
// The owning LocationBarViewGtk.
const LocationBarViewGtk* parent_;
- // The currently shown bubble if any.
- ContentSettingBubbleGtk* content_setting_bubble_;
-
// When we show explanatory text, we slide it in/out.
ui::SlideAnimation animation_;
// The label's default requisition (cached so we can animate accordingly).
GtkRequisition label_req_;
- base::WeakPtrFactory<ContentSettingImageViewGtk> weak_factory_;
+ base::WeakPtrFactory<PageToolViewGtk> weak_factory_;
- DISALLOW_COPY_AND_ASSIGN(ContentSettingImageViewGtk);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PageToolViewGtk);
};
+ private:
class PageActionViewGtk :
public ImageLoadingTracker::Observer,
public content::NotificationObserver,
@@ -462,7 +460,7 @@ class LocationBarViewGtk : public OmniboxEditController,
// Content setting icons.
ui::OwnedWidgetGtk content_setting_hbox_;
- ScopedVector<ContentSettingImageViewGtk> content_setting_views_;
+ ScopedVector<PageToolViewGtk> content_setting_views_;
// Extension page actions.
std::vector<ExtensionAction*> page_actions_;
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/location_bar_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698