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/tab_contents | |
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/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/navigation_entry.h | 10 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.h | 9 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.cc | 24 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.h | 2 |
4 files changed, 41 insertions, 4 deletions
diff --git a/chrome/browser/tab_contents/navigation_entry.h b/chrome/browser/tab_contents/navigation_entry.h index 55ed4f3..48e1750 100644 --- a/chrome/browser/tab_contents/navigation_entry.h +++ b/chrome/browser/tab_contents/navigation_entry.h @@ -15,6 +15,7 @@ #include "googleurl/src/gurl.h" #include "grit/theme_resources.h" #include "skia/include/SkBitmap.h" +#include "webkit/glue/feed.h" class NavigationController; @@ -323,6 +324,14 @@ class NavigationEntry { // if there is no navigation. bool IsViewSourceMode() const; + // Feed accessor. + void set_feedlist(scoped_refptr<FeedList> feedlist) { + feedlist_ = feedlist; + } + scoped_refptr<FeedList> feedlist() { + return feedlist_; + } + // Tracking stuff ------------------------------------------------------------ // The transition type indicates what the user did to move to this page from @@ -393,6 +402,7 @@ class NavigationEntry { std::string content_state_; int32 page_id_; SSLStatus ssl_; + scoped_refptr<FeedList> feedlist_; PageTransition::Type transition_type_; GURL user_typed_url_; bool has_post_data_; diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index 89b7430..b7a2cc9 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -74,10 +74,11 @@ class TabContents : public PageNavigator, // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it // what has changed. Combine them to update more than one thing. enum InvalidateTypes { - INVALIDATE_URL = 1, // The URL has changed. - INVALIDATE_TITLE = 2, // The title has changed. - INVALIDATE_FAVICON = 4, // The favicon has changed. - INVALIDATE_LOAD = 8, // The loading state has changed + INVALIDATE_URL = 1, // The URL has changed. + INVALIDATE_TITLE = 2, // The title has changed. + INVALIDATE_FAVICON = 4, // The favicon has changed. + INVALIDATE_LOAD = 8, // The loading state has changed. + INVALIDATE_FEEDLIST = 16, // The Atom/RSS feed has changed. // Helper for forcing a refresh. INVALIDATE_EVERYTHING = 0xFFFFFFFF diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc index 5b935b5..1e50600 100644 --- a/chrome/browser/tab_contents/web_contents.cc +++ b/chrome/browser/tab_contents/web_contents.cc @@ -42,6 +42,7 @@ #include "net/base/mime_util.h" #include "net/base/net_errors.h" #include "net/base/registry_controlled_domain.h" +#include "webkit/glue/feed.h" #include "webkit/glue/webkit_glue.h" #if defined(OS_WIN) @@ -807,6 +808,29 @@ void WebContents::UpdateTitle(RenderViewHost* rvh, NotifyNavigationStateChanged(INVALIDATE_TITLE); } +void WebContents::UpdateFeedList( + RenderViewHost* rvh, const ViewHostMsg_UpdateFeedList_Params& params) { + if (!controller()) + return; + + // We might have an old RenderViewHost sending messages, and we should ignore + // those messages. + if (rvh != render_view_host()) + return; + + NavigationEntry* entry = controller()->GetEntryWithPageID(type(), + GetSiteInstance(), + params.page_id); + if (!entry) + return; + + entry->set_feedlist(params.feedlist); + + // Broadcast notifications when the UI should be updated. + if (entry == controller()->GetEntryAtOffset(0)) + NotifyNavigationStateChanged(INVALIDATE_FEEDLIST); +} + void WebContents::UpdateEncoding(RenderViewHost* render_view_host, const std::wstring& encoding) { set_encoding(encoding); diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h index 5a07b5f..5ac7526 100644 --- a/chrome/browser/tab_contents/web_contents.h +++ b/chrome/browser/tab_contents/web_contents.h @@ -301,6 +301,8 @@ class WebContents : public TabContents, virtual void UpdateTitle(RenderViewHost* render_view_host, int32 page_id, const std::wstring& title); + virtual void UpdateFeedList(RenderViewHost* render_view_host, + const ViewHostMsg_UpdateFeedList_Params& params); virtual void UpdateEncoding(RenderViewHost* render_view_host, const std::wstring& encoding); virtual void UpdateTargetURL(int32 page_id, const GURL& url); |