diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-13 21:52:32 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-13 21:52:32 +0000 |
commit | 4604d1f4944206f24e864c71e29bc08b4d9500af (patch) | |
tree | 8dc2637b180b5c6e8a21b1984afb1a7bfa17c10b /chrome/browser/views/location_bar_view.h | |
parent | a04f125f5fe5bbc56a3feaac4121a29452becedf (diff) | |
download | chromium_src-4604d1f4944206f24e864c71e29bc08b4d9500af.zip chromium_src-4604d1f4944206f24e864c71e29bc08b4d9500af.tar.gz chromium_src-4604d1f4944206f24e864c71e29bc08b4d9500af.tar.bz2 |
RSS feed support (part 1), 2nd attempt.
Part 1 is RSS feed auto-discovery.
This will parse the web page header to find the
feeds in the document and notify the browser to
display the RSS icon in the toolbar. You can
click on the icon, but it will just navigate to
the first feed on the page, which (unless it has
been designed to be browser friendly) will just
dump XML as text on the user.
For this reason I have disabled the code that
makes the RSS icon appear and intend to enable
it when we have a good landing page to display
the XML.
Review URL: http://codereview.chromium.org/46055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11672 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/location_bar_view.h')
-rw-r--r-- | chrome/browser/views/location_bar_view.h | 79 |
1 files changed, 67 insertions, 12 deletions
diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h index 07b9e06..99822f4 100644 --- a/chrome/browser/views/location_bar_view.h +++ b/chrome/browser/views/location_bar_view.h @@ -120,6 +120,7 @@ class LocationBarView : public LocationBar, virtual void AcceptInput(); virtual void FocusLocation(); virtual void FocusSearch(); + virtual void UpdateFeedIcon(); virtual void SaveStateToContents(TabContents* contents); static const int kVertMargin; @@ -224,13 +225,45 @@ class LocationBarView : public LocationBar, class ShowInfoBubbleTask; class ShowFirstRunBubbleTask; + class LocationBarImageView : public views::ImageView, + public InfoBubbleDelegate { + public: + LocationBarImageView(); + virtual ~LocationBarImageView(); + + // Overridden from view for the mouse hovering. + virtual void OnMouseMoved(const views::MouseEvent& event); + virtual void OnMouseExited(const views::MouseEvent& event); + virtual bool OnMousePressed(const views::MouseEvent& event) = 0; + + // InfoBubbleDelegate + void InfoBubbleClosing(InfoBubble* info_bubble, bool closed_by_escape); + bool CloseOnEscape() { return true; } + + virtual void ShowInfoBubble() = 0; + + protected: + void ShowInfoBubbleImpl(const std::wstring& text, SkColor text_color); + + private: + friend class ShowInfoBubbleTask; + + // The currently shown info bubble if any. + InfoBubble* info_bubble_; + + // A task used to display the info bubble when the mouse hovers on the + // image. + ShowInfoBubbleTask* show_info_bubble_task_; + + DISALLOW_COPY_AND_ASSIGN(LocationBarImageView); + }; + // SecurityImageView is used to display the lock or warning icon when the // current URL's scheme is https. // // If a message has been set with SetInfoBubbleText, it displays an info // bubble when the mouse hovers on the image. - class SecurityImageView : public views::ImageView, - public InfoBubbleDelegate { + class SecurityImageView : public LocationBarImageView { public: enum Image { LOCK = 0, @@ -244,21 +277,13 @@ class LocationBarView : public LocationBar, void SetImageShown(Image image); // Overridden from view for the mouse hovering. - virtual void OnMouseMoved(const views::MouseEvent& event); - virtual void OnMouseExited(const views::MouseEvent& event); virtual bool OnMousePressed(const views::MouseEvent& event); - // InfoBubbleDelegate - void InfoBubbleClosing(InfoBubble* info_bubble, bool closed_by_escape); - bool CloseOnEscape() { return true; } - void set_profile(Profile* profile) { profile_ = profile; } - private: - friend class ShowInfoBubbleTask; - - void ShowInfoBubble(); + virtual void ShowInfoBubble(); + private: // The lock icon shown when using HTTPS. static SkBitmap* lock_icon_; @@ -279,6 +304,30 @@ class LocationBarView : public LocationBar, DISALLOW_EVIL_CONSTRUCTORS(SecurityImageView); }; + // RssImageView is used to display the RSS icon when the page has a feed that + // you can subscribe to. + // + // If a message has been set with SetInfoBubbleText, it displays an info + // bubble when the mouse hovers on the image. + class RssImageView : public LocationBarImageView { + public: + explicit RssImageView(ToolbarModel* model); + virtual ~RssImageView(); + + // Overridden from view for the mouse hovering. + virtual bool OnMousePressed(const views::MouseEvent& event); + + virtual void ShowInfoBubble(); + + private: + // The RSS icon shown when page has a feed. + static SkBitmap* rss_icon_; + + ToolbarModel* model_; + + DISALLOW_COPY_AND_ASSIGN(RssImageView); + }; + // Both Layout and OnChanged call into this. This updates the contents // of the 3 views: selected_keyword, keyword_hint and type_search_view. If // force_layout is true, or one of these views has changed in such a way as @@ -316,6 +365,9 @@ class LocationBarView : public LocationBar, // Sets the security icon to display. Note that no repaint is done. void SetSecurityIcon(ToolbarModel::Icon icon); + // Sets the RSS icon visibility. + void SetRssIconVisibility(FeedList* feeds); + // Sets the text that should be displayed in the info label and its associated // tooltip text. Call with an empty string if the info label should be // hidden. @@ -381,6 +433,9 @@ class LocationBarView : public LocationBar, // The view that shows the lock/warning when in HTTPS mode. SecurityImageView security_image_view_; + // The view that shows the RSS icon when the page has an RSS feed. + RssImageView rss_image_view_; + // A label displayed after the lock icon to show some extra information. views::Label info_label_; |