Commit 06ac889f authored by gbillock@chromium.org's avatar gbillock@chromium.org

Refactor location bar content setting image GTK classes to

support web intents picker button.

R=bauerb@chromium.org
BUG=None
TEST=None


Review URL: https://chromiumcodereview.appspot.com/10835020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148826 0039d316-1c4b-4281-b951-d872f2087c98
parent 51bc3846
...@@ -168,68 +168,66 @@ class LocationBarViewGtk : public OmniboxEditController, ...@@ -168,68 +168,66 @@ class LocationBarViewGtk : public OmniboxEditController,
// Edit background color. // Edit background color.
static const GdkColor kBackgroundColor; static const GdkColor kBackgroundColor;
private: // Superclass for content settings icons shown at the left side of the
class ContentSettingImageViewGtk : public BubbleDelegateGtk, // location bar.
public ui::AnimationDelegate { class PageToolViewGtk : public ui::AnimationDelegate {
public: public:
ContentSettingImageViewGtk(ContentSettingsType content_type, explicit PageToolViewGtk(const LocationBarViewGtk* parent);
const LocationBarViewGtk* parent); virtual ~PageToolViewGtk();
virtual ~ContentSettingImageViewGtk();
GtkWidget* widget() { return alignment_.get(); } GtkWidget* widget();
bool IsVisible(); bool IsVisible();
void UpdateFromWebContents(content::WebContents* web_contents); virtual void Update(TabContents* tab_contents) = 0;
// Overridden from ui::AnimationDelegate: // Overridden from ui::AnimationDelegate:
virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
virtual void AnimationCanceled(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. // Start the process of showing the label.
void StartAnimating(); void StartAnimating();
// Slide the label shut. // Slide the label shut.
void CloseAnimation(); void CloseAnimation();
CHROMEGTK_CALLBACK_1(ContentSettingImageViewGtk, gboolean, OnButtonPressed, CHROMEGTK_CALLBACK_1(PageToolViewGtk, gboolean, OnButtonPressed, GdkEvent*);
GdkEvent*); CHROMEGTK_CALLBACK_1(PageToolViewGtk, gboolean, OnExpose, GdkEventExpose*);
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_;
// The widgets for this content settings view. // The widgets for this view.
ui::OwnedWidgetGtk alignment_; ui::OwnedWidgetGtk alignment_;
ui::OwnedWidgetGtk event_box_; ui::OwnedWidgetGtk event_box_;
GtkWidget* hbox_; GtkWidget* hbox_;
ui::OwnedWidgetGtk image_; ui::OwnedWidgetGtk image_;
// Explanatory text ("popup blocked"). // Explanatory text (e.g. "popup blocked").
ui::OwnedWidgetGtk label_; ui::OwnedWidgetGtk label_;
// The owning LocationBarViewGtk. // The owning LocationBarViewGtk.
const LocationBarViewGtk* parent_; const LocationBarViewGtk* parent_;
// The currently shown bubble if any.
ContentSettingBubbleGtk* content_setting_bubble_;
// When we show explanatory text, we slide it in/out. // When we show explanatory text, we slide it in/out.
ui::SlideAnimation animation_; ui::SlideAnimation animation_;
// The label's default requisition (cached so we can animate accordingly). // The label's default requisition (cached so we can animate accordingly).
GtkRequisition label_req_; 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 : class PageActionViewGtk :
public ImageLoadingTracker::Observer, public ImageLoadingTracker::Observer,
public content::NotificationObserver, public content::NotificationObserver,
...@@ -462,7 +460,7 @@ class LocationBarViewGtk : public OmniboxEditController, ...@@ -462,7 +460,7 @@ class LocationBarViewGtk : public OmniboxEditController,
// Content setting icons. // Content setting icons.
ui::OwnedWidgetGtk content_setting_hbox_; ui::OwnedWidgetGtk content_setting_hbox_;
ScopedVector<ContentSettingImageViewGtk> content_setting_views_; ScopedVector<PageToolViewGtk> content_setting_views_;
// Extension page actions. // Extension page actions.
std::vector<ExtensionAction*> page_actions_; std::vector<ExtensionAction*> page_actions_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment