summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-19 18:37:21 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-19 18:37:21 +0000
commitd8c6cabdea33f84a488f529bb027491739b2fb6e (patch)
tree8207fe14c048bbf22024dab8f208525602dacd67 /chrome/browser/history
parentb0ae9ea4ee49d8585a3886777ffa2957bb5e830a (diff)
downloadchromium_src-d8c6cabdea33f84a488f529bb027491739b2fb6e.zip
chromium_src-d8c6cabdea33f84a488f529bb027491739b2fb6e.tar.gz
chromium_src-d8c6cabdea33f84a488f529bb027491739b2fb6e.tar.bz2
Remove web store icon from most visited per Glen.
BUG=52669 Review URL: http://codereview.chromium.org/3140018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56721 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r--chrome/browser/history/top_sites.cc62
-rw-r--r--chrome/browser/history/top_sites.h9
-rw-r--r--chrome/browser/history/top_sites_unittest.cc48
3 files changed, 0 insertions, 119 deletions
diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc
index ad49b64..c0e4580 100644
--- a/chrome/browser/history/top_sites.cc
+++ b/chrome/browser/history/top_sites.cc
@@ -16,8 +16,6 @@
#include "base/values.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/dom_ui/most_visited_handler.h"
-#include "chrome/browser/extensions/extensions_service.h"
-#include "chrome/browser/google_util.h"
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/page_usage_data.h"
#include "chrome/browser/history/top_sites_database.h"
@@ -271,63 +269,6 @@ static int IndexOf(const MostVisitedURLList& urls, const GURL& url) {
return -1;
}
-int TopSites::GetIndexForChromeStore(const MostVisitedURLList& urls) {
- GURL store_url = MostVisitedHandler::GetChromeStoreURLWithLocale();
- {
- AutoLock lock(lock_);
- if (IsBlacklisted(store_url))
- return -1;
- }
-
- if (IndexOf(urls, store_url) != -1)
- return -1; // It's already there, no need to add.
-
- // Should replace the first filler.
- int first_filler = IndexOf(urls, GURL());
- if (first_filler != -1)
- return first_filler;
-
- if (urls.size() < kTopSitesShown)
- return urls.size();
-
- // Should replace the last non-pinned url.
- for (size_t i = kTopSitesShown - 1; i < urls.size(); i--) {
- if (!IsURLPinned(urls[i].url))
- return i;
- }
-
- // All urls are pinned.
- return -1;
-}
-
-bool TopSites::AddChromeStore(MostVisitedURLList* urls) {
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableApps))
- return false;
-
- if (!profile_)
- return false;
-
- ExtensionsService* service = profile_->GetExtensionsService();
- if (!service || service->HasApps())
- return false;
-
- int index = GetIndexForChromeStore(*urls);
- if (index == -1)
- return false;
-
- if (static_cast<size_t>(index) >= urls->size())
- urls->resize(index + 1);
-
- // Chrome App store may replace an existing non-pinned thumbnail.
- MostVisitedURL& url = (*urls)[index];
- url.url = MostVisitedHandler::GetChromeStoreURLWithLocale();
- url.title = l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE);
- url.favicon_url =
- GURL("chrome://theme/IDR_NEWTAB_CHROME_STORE_PAGE_FAVICON");
- url.redirects.push_back(url.url);
- return true;
-}
-
bool TopSites::AddPrepopulatedPages(MostVisitedURLList* urls) {
// TODO(arv): This needs to get the data from some configurable place.
// http://crbug.com/17630
@@ -356,9 +297,6 @@ bool TopSites::AddPrepopulatedPages(MostVisitedURLList* urls) {
added = true;
}
- if (AddChromeStore(urls))
- added = true;
-
return added;
}
diff --git a/chrome/browser/history/top_sites.h b/chrome/browser/history/top_sites.h
index 8c11681..b4063ab 100644
--- a/chrome/browser/history/top_sites.h
+++ b/chrome/browser/history/top_sites.h
@@ -153,7 +153,6 @@ class TopSites :
FRIEND_TEST_ALL_PREFIXES(TopSitesTest, PinnedURLs);
FRIEND_TEST_ALL_PREFIXES(TopSitesTest, BlacklistingAndPinnedURLs);
FRIEND_TEST_ALL_PREFIXES(TopSitesTest, AddPrepopulatedPages);
- FRIEND_TEST_ALL_PREFIXES(TopSitesTest, GetIndexForChromeStore);
~TopSites();
@@ -270,14 +269,6 @@ class TopSites :
const RefCountedBytes* thumbnail,
const ThumbnailScore& score);
- // Returns an index of a thumbnail that should be replaced by the
- // Chrome App Store. Returns -1 App Store should not be added.
- int GetIndexForChromeStore(const MostVisitedURLList& urls);
-
- // Adds Chrome App Store thumbnail to a list of URLs, if possible.
- // Returns true if it was added.
- bool AddChromeStore(MostVisitedURLList* urls);
-
// Add prepopulated pages: 'welcome to Chrome' and themes gallery.
// Returns true if any pages were added.
bool AddPrepopulatedPages(MostVisitedURLList* urls);
diff --git a/chrome/browser/history/top_sites_unittest.cc b/chrome/browser/history/top_sites_unittest.cc
index d6b7ae0..d0ab05f 100644
--- a/chrome/browser/history/top_sites_unittest.cc
+++ b/chrome/browser/history/top_sites_unittest.cc
@@ -1288,52 +1288,4 @@ TEST_F(TopSitesTest, AddPrepopulatedPages) {
EXPECT_EQ(welcome_url(), pages[1].url);
}
-TEST_F(TopSitesTest, GetIndexForChromeStore) {
- MostVisitedURLList pages;
- EXPECT_EQ(0, top_sites().GetIndexForChromeStore(pages));
-
- MostVisitedURL url = {themes_url()};
- pages.push_back(url);
- EXPECT_EQ(1, top_sites().GetIndexForChromeStore(pages));
-
- // Store should be added in the first filler.
- top_sites().AddPinnedURL(welcome_url(), 3);
- top_sites().AddPinnedURL(GURL("http://google.com"), 5);
- EXPECT_EQ(1, top_sites().GetIndexForChromeStore(pages));
-
- GURL store_url = MostVisitedHandler::GetChromeStoreURLWithLocale();
- url.url = store_url;
- pages.push_back(url);
-
- // Don't add store again.
- EXPECT_EQ(-1, top_sites().GetIndexForChromeStore(pages));
-
- pages.pop_back();
- EXPECT_EQ(1, top_sites().GetIndexForChromeStore(pages));
-
- pages.clear();
- url.url = GURL("http://bbc.com/");
- for (int i = 0; i < 8; i++) {
- pages.push_back(url);
- }
-
- EXPECT_EQ(7, top_sites().GetIndexForChromeStore(pages));
-
- pages[7].url = GURL("http://gmail.com");
- top_sites().AddPinnedURL(GURL("http://gmail.com"), 7);
-
- EXPECT_EQ(6, top_sites().GetIndexForChromeStore(pages));
-
- // If it's blacklisted, it should not be added.
- top_sites().AddBlacklistedURL(store_url);
- EXPECT_EQ(-1, top_sites().GetIndexForChromeStore(pages));
-
- top_sites().RemoveBlacklistedURL(store_url);
- EXPECT_EQ(6, top_sites().GetIndexForChromeStore(pages));
-
- top_sites().AddPinnedURL(GURL("http://bbc.com"), 2);
- // All pinned - can't add store.
- EXPECT_EQ(-1, top_sites().GetIndexForChromeStore(pages));
-}
-
} // namespace history