From cbc0e9cc6651df9bb4a256c30c7d4a8fce36d066 Mon Sep 17 00:00:00 2001 From: "finnur@chromium.org" Date: Mon, 4 May 2009 22:48:08 +0000 Subject: Fix bug 9812: Remove current RSS code in favor of new more generalized PageAction code that serves the same purpose (and more). BUG=9812 TEST=No test needed, this shouldn't result in any noticable difference since the RSS parsing was disabled. Review URL: http://codereview.chromium.org/100356 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15247 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/feed.h | 46 -------------------------------- webkit/glue/webframe.h | 5 ---- webkit/glue/webframe_impl.cc | 63 -------------------------------------------- webkit/glue/webframe_impl.h | 1 - 4 files changed, 115 deletions(-) delete mode 100644 webkit/glue/feed.h (limited to 'webkit') diff --git a/webkit/glue/feed.h b/webkit/glue/feed.h deleted file mode 100644 index e475c4a..0000000 --- a/webkit/glue/feed.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. - -#ifndef CHROME_COMMON_FEED_H_ -#define CHROME_COMMON_FEED_H_ - -#include -#include - -#include "base/ref_counted.h" -#include "googleurl/src/gurl.h" - -struct FeedItem { - // The feed title. - std::wstring title; - // The feed type, for example: "application/rss+xml". The type can be blank. - std::wstring type; - // The URL to subscribe to the feed. - GURL url; -}; - -class FeedList : public base::RefCounted { - public: - // We limit the number of feeds that can be sent so that a rouge renderer - // doesn't cause excessive memory usage in the browser process by specifying - // a huge number of RSS feeds for the browser to parse. - static const size_t kMaxFeeds = 50; - - FeedList() {} - - void Add(const FeedItem &item) { - list_.push_back(item); - } - - const std::vector& list() const { - return list_; - } - - private: - std::vector list_; - - DISALLOW_COPY_AND_ASSIGN(FeedList); -}; - -#endif // CHROME_COMMON_FEED_H_ diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h index 67a1013..e1495fa 100644 --- a/webkit/glue/webframe.h +++ b/webkit/glue/webframe.h @@ -9,7 +9,6 @@ #include "googleurl/src/gurl.h" #include "skia/ext/bitmap_platform_device.h" #include "skia/ext/platform_canvas.h" -#include "webkit/glue/feed.h" class WebAppCacheContext; class WebDataSource; @@ -146,10 +145,6 @@ class WebFrame { // Return the minPrefWidth of the content contained in the current Document virtual int GetContentsPreferredWidth() const = 0; - // Return the list of feeds specified in the document for the frame. If - // the page does not have a valid document, an empty list is returned. - virtual scoped_refptr GetFeedList() const = 0; - // Returns the committed data source, which is the last data source that has // successfully started loading. Will return NULL if no provisional data // has been committed. diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index 3b87d4f..d6b39fc 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -143,7 +143,6 @@ MSVC_POP_WARNING(); #include "webkit/glue/alt_error_page_resource_fetcher.h" #include "webkit/glue/dom_operations.h" #include "webkit/glue/dom_operations_private.h" -#include "webkit/glue/feed.h" #include "webkit/glue/glue_serialize.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webappcachecontext.h" @@ -563,68 +562,6 @@ int WebFrameImpl::GetContentsPreferredWidth() const { } } -scoped_refptr WebFrameImpl::GetFeedList() const { - scoped_refptr feedlist = new FeedList(); - - WebCore::FrameLoader* frame_loader = frame_->loader(); - if (frame_loader->state() != WebCore::FrameStateComplete || - !frame_->document() || - !frame_->document()->head() || - frame_->tree()->parent()) - return feedlist; - - // We only consider HTML documents with tags. - // (Interestingly, isHTMLDocument() returns false for some pages -- - // perhaps an XHTML thing? It doesn't really matter because head() is - // a method on Documents anyway.) - WebCore::HTMLHeadElement* head = frame_->document()->head(); - if (!head) - return feedlist; - - // Iterate through all children of the , looking for feed links. - for (WebCore::Node* node = head->firstChild(); - node; node = node->nextSibling()) { - // Skip over all nodes except . - if (!node->isHTMLElement()) - continue; - if (!static_cast(node)->hasLocalName("link")) - continue; - - const WebCore::HTMLLinkElement* link = - static_cast(node); - - // Look at the 'rel' tag and see if we have a feed. - std::wstring rel = webkit_glue::StringToStdWString(link->rel()); - bool is_feed = false; - if (LowerCaseEqualsASCII(rel, "feed") || - LowerCaseEqualsASCII(rel, "feed alternate")) { - // rel="feed" or rel="alternate feed" always means this is a feed. - is_feed = true; - } else if (LowerCaseEqualsASCII(rel, "alternate")) { - // Otherwise, rel="alternate" may mean a feed if it has a certain mime - // type. - std::wstring link_type = webkit_glue::StringToStdWString(link->type()); - TrimWhitespace(link_type, TRIM_ALL, &link_type); - if (LowerCaseEqualsASCII(link_type, "application/atom+xml") || - LowerCaseEqualsASCII(link_type, "application/rss+xml")) { - is_feed = true; - } - } - - if (is_feed) { - FeedItem feedItem; - feedItem.title = webkit_glue::StringToStdWString(link->title()); - TrimWhitespace(feedItem.title, TRIM_ALL, &feedItem.title); - feedItem.type = webkit_glue::StringToStdWString(link->type()); - TrimWhitespace(feedItem.type, TRIM_ALL, &feedItem.type); - feedItem.url = webkit_glue::KURLToGURL(link->href()); - feedlist->Add(feedItem); - } - } - - return feedlist; -} - bool WebFrameImpl::GetPreviousHistoryState(std::string* history_state) const { // We use the previous item here because documentState (filled-out forms) // only get saved to history when it becomes the previous item. The caller diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index 61162f7..c3cbbb4 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -102,7 +102,6 @@ class WebFrameImpl : public WebFrame, public base::RefCounted { virtual GURL GetFavIconURL() const; virtual GURL GetOSDDURL() const; virtual int GetContentsPreferredWidth() const; - virtual scoped_refptr GetFeedList() const; virtual WebDataSource* GetDataSource() const; virtual WebDataSource* GetProvisionalDataSource() const; virtual void StopLoading(); -- cgit v1.1