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

Unified Diff: content/browser/tab_contents/tab_contents.cc

Issue 6735042: Move favicon from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 9 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 | « content/browser/tab_contents/tab_contents.h ('k') | content/browser/tab_contents/tab_contents_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tab_contents/tab_contents.cc
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index d1866ab4711edcd5fa8834acfc084ad2cc8053cc..fc6d5194a3d063734397e65cad8ed0f23807e675 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -28,7 +28,6 @@
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/download_request_limiter.h"
#include "chrome/browser/external_protocol_handler.h"
-#include "chrome/browser/favicon_service.h"
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_types.h"
@@ -377,7 +376,6 @@ TabContents::~TabContents() {
}
void TabContents::AddObservers() {
- favicon_helper_.reset(new FaviconHelper(this));
desktop_notification_handler_.reset(
new DesktopNotificationHandlerForTC(this, GetRenderProcessHost()));
plugin_observer_.reset(new PluginObserver(this));
@@ -521,42 +519,6 @@ bool TabContents::ShouldDisplayURL() {
return true;
}
-SkBitmap TabContents::GetFavicon() const {
- // Like GetTitle(), we also want to use the favicon for the last committed
- // entry rather than a pending navigation entry.
- NavigationEntry* entry = controller_.GetTransientEntry();
- if (entry)
- return entry->favicon().bitmap();
-
- entry = controller_.GetLastCommittedEntry();
- if (entry)
- return entry->favicon().bitmap();
- return SkBitmap();
-}
-
-bool TabContents::FaviconIsValid() const {
- NavigationEntry* entry = controller_.GetTransientEntry();
- if (entry)
- return entry->favicon().is_valid();
-
- entry = controller_.GetLastCommittedEntry();
- if (entry)
- return entry->favicon().is_valid();
-
- return false;
-}
-
-bool TabContents::ShouldDisplayFavicon() {
- // Always display a throbber during pending loads.
- if (controller_.GetLastCommittedEntry() && controller_.pending_entry())
- return true;
-
- WebUI* web_ui = GetWebUIForCurrentState();
- if (web_ui)
- return !web_ui->hide_favicon();
- return true;
-}
-
void TabContents::AddObserver(TabContentsObserver* observer) {
observers_.AddObserver(observer);
}
@@ -708,15 +670,8 @@ bool TabContents::NavigateToEntry(
}
// Notify observers about navigation.
- FOR_EACH_OBSERVER(TabContentsObserver, observers_, NavigateToPendingEntry());
-
- if (reload_type != NavigationController::NO_RELOAD &&
- !profile()->IsOffTheRecord()) {
- FaviconService* favicon_service =
- profile()->GetFaviconService(Profile::IMPLICIT_ACCESS);
- if (favicon_service)
- favicon_service->SetFaviconOutOfDateForPage(entry.url());
- }
+ FOR_EACH_OBSERVER(TabContentsObserver, observers_,
+ NavigateToPendingEntry(entry.url(), reload_type));
return true;
}
@@ -750,34 +705,6 @@ void TabContents::ShowPageInfo(const GURL& url,
delegate_->ShowPageInfo(profile(), url, ssl, show_history);
}
-void TabContents::SaveFavicon() {
- NavigationEntry* entry = controller_.GetActiveEntry();
- if (!entry || entry->url().is_empty())
- return;
-
- // Make sure the page is in history, otherwise adding the favicon does
- // nothing.
- HistoryService* history = profile()->GetOriginalProfile()->GetHistoryService(
- Profile::IMPLICIT_ACCESS);
- if (!history)
- return;
- history->AddPageNoVisitForBookmark(entry->url());
-
- FaviconService* service = profile()->GetOriginalProfile()->GetFaviconService(
- Profile::IMPLICIT_ACCESS);
- if (!service)
- return;
- const NavigationEntry::FaviconStatus& favicon(entry->favicon());
- if (!favicon.is_valid() || favicon.url().is_empty() ||
- favicon.bitmap().empty()) {
- return;
- }
- std::vector<unsigned char> image_data;
- gfx::PNGCodec::EncodeBGRASkBitmap(favicon.bitmap(), false, &image_data);
- service->SetFavicon(
- entry->url(), favicon.url(), image_data, history::FAVICON);
-}
-
ConstrainedWindow* TabContents::CreateConstrainedDialog(
ConstrainedWindowDelegate* delegate) {
ConstrainedWindow* window =
@@ -1565,9 +1492,6 @@ void TabContents::DidNavigateMainFramePostCommit(
// Allow the new page to set the title again.
received_page_title_ = false;
- // Get the favicon, either from history or request it from the net.
- favicon_helper_->FetchFavicon(details.entry->url());
-
// Clear all page actions, blocked content notifications and browser actions
// for this tab, unless this is an in-page navigation.
if (!details.is_in_page) {
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | content/browser/tab_contents/tab_contents_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698